Merge pull request #13548 from thingsboard/fix/cf-error
Handle ExecutionException in controllers
This commit is contained in:
commit
8f69bc0ea5
@ -199,6 +199,7 @@ import java.util.Objects;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@ -420,7 +421,7 @@ public abstract class BaseController {
|
|||||||
return handleException(exception, true);
|
return handleException(exception, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ThingsboardException handleException(Exception exception, boolean logException) {
|
private ThingsboardException handleException(Throwable exception, boolean logException) {
|
||||||
if (logException && logControllerErrorStackTrace) {
|
if (logException && logControllerErrorStackTrace) {
|
||||||
try {
|
try {
|
||||||
SecurityUser user = getCurrentUser();
|
SecurityUser user = getCurrentUser();
|
||||||
@ -431,6 +432,9 @@ public abstract class BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Throwable cause = exception.getCause();
|
Throwable cause = exception.getCause();
|
||||||
|
if (exception instanceof ExecutionException) {
|
||||||
|
exception = cause;
|
||||||
|
}
|
||||||
if (exception instanceof ThingsboardException) {
|
if (exception instanceof ThingsboardException) {
|
||||||
return (ThingsboardException) exception;
|
return (ThingsboardException) exception;
|
||||||
} else if (exception instanceof IllegalArgumentException || exception instanceof IncorrectParameterException
|
} else if (exception instanceof IllegalArgumentException || exception instanceof IncorrectParameterException
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user