Class ExceptionTranslator
java.lang.Object
org.powertac.visualizer.web.rest.errors.ExceptionTranslator
- All Implemented Interfaces:
org.zalando.problem.spring.common.AdviceTrait,org.zalando.problem.spring.web.advice.AdviceTrait,org.zalando.problem.spring.web.advice.general.GeneralAdviceTrait,org.zalando.problem.spring.web.advice.general.ProblemAdviceTrait,org.zalando.problem.spring.web.advice.general.ResponseStatusAdviceTrait,org.zalando.problem.spring.web.advice.general.ThrowableAdviceTrait,org.zalando.problem.spring.web.advice.general.UnsupportedOperationAdviceTrait,org.zalando.problem.spring.web.advice.http.HttpAdviceTrait,org.zalando.problem.spring.web.advice.http.MethodNotAllowedAdviceTrait,org.zalando.problem.spring.web.advice.http.NotAcceptableAdviceTrait,org.zalando.problem.spring.web.advice.http.UnsupportedMediaTypeAdviceTrait,org.zalando.problem.spring.web.advice.io.IOAdviceTrait,org.zalando.problem.spring.web.advice.io.MessageNotReadableAdviceTrait,org.zalando.problem.spring.web.advice.io.MultipartAdviceTrait,org.zalando.problem.spring.web.advice.io.TypeMismatchAdviceTrait,org.zalando.problem.spring.web.advice.network.NetworkAdviceTrait,org.zalando.problem.spring.web.advice.network.SocketTimeoutAdviceTrait,org.zalando.problem.spring.web.advice.ProblemHandling,org.zalando.problem.spring.web.advice.routing.MissingServletRequestParameterAdviceTrait,org.zalando.problem.spring.web.advice.routing.MissingServletRequestPartAdviceTrait,org.zalando.problem.spring.web.advice.routing.NoHandlerFoundAdviceTrait,org.zalando.problem.spring.web.advice.routing.RoutingAdviceTrait,org.zalando.problem.spring.web.advice.routing.ServletRequestBindingAdviceTrait,org.zalando.problem.spring.web.advice.validation.BaseBindingResultAdviceTrait,org.zalando.problem.spring.web.advice.validation.BindAdviceTrait,org.zalando.problem.spring.web.advice.validation.ConstraintViolationAdviceTrait,org.zalando.problem.spring.web.advice.validation.MethodArgumentNotValidAdviceTrait,org.zalando.problem.spring.web.advice.validation.ValidationAdviceTrait
@ControllerAdvice public class ExceptionTranslator extends Object implements org.zalando.problem.spring.web.advice.ProblemHandling
Controller advice to translate the server side exceptions to client-friendly json structures.
The error response follows RFC7807 - Problem Details for HTTP APIs (https://tools.ietf.org/html/rfc7807)
-
Constructor Summary
Constructors Constructor Description ExceptionTranslator() -
Method Summary
Modifier and Type Method Description default org.zalando.problem.StatusTypedefaultConstraintViolationStatus()default URIdefaultConstraintViolationType()default StringformatFieldName(String arg0)org.springframework.http.ResponseEntity<org.zalando.problem.Problem>handleBadRequestAlertException(BadRequestAlertException ex, org.springframework.web.context.request.NativeWebRequest request)org.springframework.http.ResponseEntity<org.zalando.problem.Problem>handleConcurrencyFailure(org.springframework.dao.ConcurrencyFailureException ex, org.springframework.web.context.request.NativeWebRequest request)org.springframework.http.ResponseEntity<org.zalando.problem.Problem>handleMethodArgumentNotValid(org.springframework.web.bind.MethodArgumentNotValidException ex, org.springframework.web.context.request.NativeWebRequest request)org.springframework.http.ResponseEntity<org.zalando.problem.Problem>handleNoSuchElementException(NoSuchElementException ex, org.springframework.web.context.request.NativeWebRequest request)default org.springframework.http.ResponseEntity<org.zalando.problem.Problem>newConstraintViolationProblem(Throwable arg0, Collection<org.zalando.problem.violations.Violation> arg1, org.springframework.web.context.request.NativeWebRequest arg2)org.springframework.http.ResponseEntity<org.zalando.problem.Problem>process(org.springframework.http.ResponseEntity<org.zalando.problem.Problem> entity, org.springframework.web.context.request.NativeWebRequest request)Post-process the Problem payload to add the message key for the front-end if neededMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.zalando.problem.spring.common.AdviceTrait
createStackTrace, isCausalChainsEnabled, prepare, process, resolveResponseStatus, toProblem, toProblem, toProblemMethods inherited from interface org.zalando.problem.spring.web.advice.AdviceTrait
create, create, create, create, create, create, create, create, create, fallback, log, negotiateMethods inherited from interface org.zalando.problem.spring.web.advice.validation.BaseBindingResultAdviceTrait
createViolation, createViolation, createViolationsMethods inherited from interface org.zalando.problem.spring.web.advice.validation.BindAdviceTrait
handleBindingResultMethods inherited from interface org.zalando.problem.spring.web.advice.validation.ConstraintViolationAdviceTrait
createViolation, handleConstraintViolationMethods inherited from interface org.zalando.problem.spring.web.advice.io.MessageNotReadableAdviceTrait
handleMessageNotReadableExceptionMethods inherited from interface org.zalando.problem.spring.web.advice.http.MethodNotAllowedAdviceTrait
handleRequestMethodNotSupportedExceptionMethods inherited from interface org.zalando.problem.spring.web.advice.routing.MissingServletRequestParameterAdviceTrait
handleMissingServletRequestParameterMethods inherited from interface org.zalando.problem.spring.web.advice.routing.MissingServletRequestPartAdviceTrait
handleMissingServletRequestPartMethods inherited from interface org.zalando.problem.spring.web.advice.io.MultipartAdviceTrait
handleMultipartMethods inherited from interface org.zalando.problem.spring.web.advice.routing.NoHandlerFoundAdviceTrait
handleNoHandlerFoundMethods inherited from interface org.zalando.problem.spring.web.advice.http.NotAcceptableAdviceTrait
handleMediaTypeNotAcceptableMethods inherited from interface org.zalando.problem.spring.web.advice.general.ProblemAdviceTrait
handleProblemMethods inherited from interface org.zalando.problem.spring.web.advice.general.ResponseStatusAdviceTrait
handleResponseStatusExceptionMethods inherited from interface org.zalando.problem.spring.web.advice.routing.ServletRequestBindingAdviceTrait
handleServletRequestBindingMethods inherited from interface org.zalando.problem.spring.web.advice.network.SocketTimeoutAdviceTrait
handleSocketTimeoutMethods inherited from interface org.zalando.problem.spring.web.advice.general.ThrowableAdviceTrait
handleThrowableMethods inherited from interface org.zalando.problem.spring.web.advice.io.TypeMismatchAdviceTrait
handleTypeMismatch
-
Constructor Details
-
ExceptionTranslator
public ExceptionTranslator()
-
-
Method Details
-
process
public org.springframework.http.ResponseEntity<org.zalando.problem.Problem> process(@Nullable org.springframework.http.ResponseEntity<org.zalando.problem.Problem> entity, org.springframework.web.context.request.NativeWebRequest request)Post-process the Problem payload to add the message key for the front-end if needed- Specified by:
processin interfaceorg.zalando.problem.spring.web.advice.AdviceTrait
-
handleMethodArgumentNotValid
public org.springframework.http.ResponseEntity<org.zalando.problem.Problem> handleMethodArgumentNotValid(org.springframework.web.bind.MethodArgumentNotValidException ex, @Nonnull org.springframework.web.context.request.NativeWebRequest request)- Specified by:
handleMethodArgumentNotValidin interfaceorg.zalando.problem.spring.web.advice.validation.MethodArgumentNotValidAdviceTrait
-
handleNoSuchElementException
@ExceptionHandler public org.springframework.http.ResponseEntity<org.zalando.problem.Problem> handleNoSuchElementException(NoSuchElementException ex, org.springframework.web.context.request.NativeWebRequest request) -
handleBadRequestAlertException
@ExceptionHandler public org.springframework.http.ResponseEntity<org.zalando.problem.Problem> handleBadRequestAlertException(BadRequestAlertException ex, org.springframework.web.context.request.NativeWebRequest request) -
handleConcurrencyFailure
@ExceptionHandler public org.springframework.http.ResponseEntity<org.zalando.problem.Problem> handleConcurrencyFailure(org.springframework.dao.ConcurrencyFailureException ex, org.springframework.web.context.request.NativeWebRequest request) -
defaultConstraintViolationType
-
defaultConstraintViolationStatus
public default org.zalando.problem.StatusType defaultConstraintViolationStatus() -
formatFieldName
-
newConstraintViolationProblem
public default org.springframework.http.ResponseEntity<org.zalando.problem.Problem> newConstraintViolationProblem(Throwable arg0, Collection<org.zalando.problem.violations.Violation> arg1, org.springframework.web.context.request.NativeWebRequest arg2)
-