From 61d28e53d565b0f154d76b335b1c96321508dcb6 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Fri, 1 Jul 2022 13:40:25 +0300 Subject: [PATCH] Handle async request timeout exception --- .../java/org/thingsboard/server/controller/BaseController.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/application/src/main/java/org/thingsboard/server/controller/BaseController.java b/application/src/main/java/org/thingsboard/server/controller/BaseController.java index a26de329b3..3d2a05659a 100644 --- a/application/src/main/java/org/thingsboard/server/controller/BaseController.java +++ b/application/src/main/java/org/thingsboard/server/controller/BaseController.java @@ -32,6 +32,7 @@ import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.context.request.async.AsyncRequestTimeoutException; import org.springframework.web.context.request.async.DeferredResult; import org.thingsboard.server.cluster.TbClusterService; import org.thingsboard.server.common.data.Customer; @@ -346,6 +347,8 @@ public abstract class BaseController { return new ThingsboardException(exception.getMessage(), ThingsboardErrorCode.BAD_REQUEST_PARAMS); } else if (exception instanceof MessagingException) { return new ThingsboardException("Unable to send mail: " + exception.getMessage(), ThingsboardErrorCode.GENERAL); + } else if (exception instanceof AsyncRequestTimeoutException) { + return new ThingsboardException("Request timeout", ThingsboardErrorCode.GENERAL); } else { return new ThingsboardException(exception.getMessage(), exception, ThingsboardErrorCode.GENERAL); }