Search in sources :

Example 1 with InternalErrorException

use of org.thingsboard.server.service.telemetry.exception.InternalErrorException in project thingsboard by thingsboard.

the class ValidationCallback method getException.

public static Exception getException(ValidationResult result) {
    ValidationResultCode resultCode = result.getResultCode();
    Exception e;
    switch(resultCode) {
        case ENTITY_NOT_FOUND:
            e = new EntityNotFoundException(result.getMessage());
            break;
        case UNAUTHORIZED:
            e = new UnauthorizedException(result.getMessage());
            break;
        case ACCESS_DENIED:
            e = new AccessDeniedException(result.getMessage());
            break;
        case INTERNAL_ERROR:
            e = new InternalErrorException(result.getMessage());
            break;
        default:
            e = new UnauthorizedException("Permission denied.");
            break;
    }
    return e;
}
Also used : AccessDeniedException(org.thingsboard.server.service.telemetry.exception.AccessDeniedException) UnauthorizedException(org.thingsboard.server.service.telemetry.exception.UnauthorizedException) EntityNotFoundException(org.thingsboard.server.service.telemetry.exception.EntityNotFoundException) InternalErrorException(org.thingsboard.server.service.telemetry.exception.InternalErrorException) EntityNotFoundException(org.thingsboard.server.service.telemetry.exception.EntityNotFoundException) AccessDeniedException(org.thingsboard.server.service.telemetry.exception.AccessDeniedException) InternalErrorException(org.thingsboard.server.service.telemetry.exception.InternalErrorException) UnauthorizedException(org.thingsboard.server.service.telemetry.exception.UnauthorizedException)

Aggregations

AccessDeniedException (org.thingsboard.server.service.telemetry.exception.AccessDeniedException)1 EntityNotFoundException (org.thingsboard.server.service.telemetry.exception.EntityNotFoundException)1 InternalErrorException (org.thingsboard.server.service.telemetry.exception.InternalErrorException)1 UnauthorizedException (org.thingsboard.server.service.telemetry.exception.UnauthorizedException)1