Merge pull request #13548 from thingsboard/fix/cf-error

Handle ExecutionException in controllers
This commit is contained in:
Viacheslav Klimov 2025-06-09 11:50:00 +03:00 committed by GitHub
commit 8f69bc0ea5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -199,6 +199,7 @@ import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Function;
@ -420,7 +421,7 @@ public abstract class BaseController {
return handleException(exception, true);
}
private ThingsboardException handleException(Exception exception, boolean logException) {
private ThingsboardException handleException(Throwable exception, boolean logException) {
if (logException && logControllerErrorStackTrace) {
try {
SecurityUser user = getCurrentUser();
@ -431,6 +432,9 @@ public abstract class BaseController {
}
Throwable cause = exception.getCause();
if (exception instanceof ExecutionException) {
exception = cause;
}
if (exception instanceof ThingsboardException) {
return (ThingsboardException) exception;
} else if (exception instanceof IllegalArgumentException || exception instanceof IncorrectParameterException