Changed validation method to throw exception/SpServerError

* changed error handling from return value to throw exceptions, to give the user a feedback what was wrong
* added ValidationException to ResponseExceptionHandler, to map the correct REST status codes

Signed-off-by: Nonnenmacher Fabian <fabian.nonnenmacher@bosch-si.com>
This commit is contained in:
Fabian Nonnenmacher
2016-01-28 15:17:12 +01:00
committed by Nonnenmacher Fabian
parent a5a0dc17f6
commit d83286c94a
11 changed files with 206 additions and 90 deletions

View File

@@ -65,6 +65,7 @@ public class ResponseExceptionHandler {
ERROR_TO_HTTP_STATUS.put(SpServerError.SP_REPO_TENANT_NOT_EXISTS, HttpStatus.BAD_REQUEST);
ERROR_TO_HTTP_STATUS.put(SpServerError.SP_ENTITY_LOCKED, HttpStatus.LOCKED);
ERROR_TO_HTTP_STATUS.put(SpServerError.SP_ROLLOUT_ILLEGAL_STATE, HttpStatus.BAD_REQUEST);
ERROR_TO_HTTP_STATUS.put(SpServerError.SP_CONFIGURATION_VALUE_INVALID, HttpStatus.BAD_REQUEST);
}
private static HttpStatus getStatusOrDefault(final SpServerError error) {