use of org.thingsboard.server.common.data.exception.ThingsboardErrorCode in project thingsboard by thingsboard.
the class ThingsboardErrorResponseHandler method handleThingsboardException.
private void handleThingsboardException(ThingsboardException thingsboardException, HttpServletResponse response) throws IOException {
ThingsboardErrorCode errorCode = thingsboardException.getErrorCode();
HttpStatus status = errorCodeToStatus(errorCode);
response.setStatus(status.value());
mapper.writeValue(response.getWriter(), ThingsboardErrorResponse.of(thingsboardException.getMessage(), errorCode, status));
}
Aggregations