Class ServiceBrokerExceptionHandler
java.lang.Object
org.springframework.cloud.servicebroker.controller.ServiceBrokerExceptionHandler
- Direct Known Subclasses:
ServiceBrokerWebFluxExceptionHandler
,ServiceBrokerWebMvcExceptionHandler
Exception handling logic shared by all Controllers.
- Author:
- Scott Frederick, Roy Clarkson
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected ErrorMessage
Format an error message for the exception.protected ErrorMessage
getErrorResponse
(String message) Create an error message object.protected ErrorMessage
Format an error message for the exception.protected abstract org.slf4j.Logger
getLog()
Callback to implementing classes to obtain the configured Logger.protected OperationInProgressMessage
Format an operation in progress message for the exception.protected ErrorMessage
handleBindingException
(Exception ex, BindingResult result) Creates an error message for binding errors.Handle aException
.Handle aServiceBrokerApiVersionException
.Handle aServiceBrokerApiVersionMissingException
.Handle aServiceBrokerAsyncRequiredException
.Handle aServiceBrokerBindingRequiresAppException
.Handle aServiceBrokerConcurrencyException
.Handle aServiceBrokerException
.Handle aServiceBrokerInvalidParametersException
.Handle aServiceBrokerUnavailableException
.Handle aServiceDefinitionDoesNotExistException
.Handle aServiceInstanceBindingExistsException
.Handle aServiceInstanceDoesNotExistException
.Handle aServiceInstanceExistsException
.
-
Field Details
-
UNPROCESSABLE_REQUEST
- See Also:
-
-
Constructor Details
-
ServiceBrokerExceptionHandler
public ServiceBrokerExceptionHandler()
-
-
Method Details
-
getLog
protected abstract org.slf4j.Logger getLog()Callback to implementing classes to obtain the configured Logger.- Returns:
- the Logger
-
handleException
@ExceptionHandler(ServiceBrokerApiVersionException.class) @ResponseStatus(PRECONDITION_FAILED) public ErrorMessage handleException(ServiceBrokerApiVersionException ex) Handle aServiceBrokerApiVersionException
.- Parameters:
ex
- the exception- Returns:
- an error message
-
handleException
@ExceptionHandler(ServiceBrokerApiVersionMissingException.class) @ResponseStatus(BAD_REQUEST) public ErrorMessage handleException(ServiceBrokerApiVersionMissingException ex) Handle aServiceBrokerApiVersionMissingException
.- Parameters:
ex
- the exception- Returns:
- an error message
-
handleException
@ExceptionHandler(ServiceInstanceDoesNotExistException.class) @ResponseStatus(UNPROCESSABLE_ENTITY) public ErrorMessage handleException(ServiceInstanceDoesNotExistException ex) Handle aServiceInstanceDoesNotExistException
.- Parameters:
ex
- the exception- Returns:
- an error message
-
handleException
@ExceptionHandler(ServiceDefinitionDoesNotExistException.class) @ResponseStatus(BAD_REQUEST) public ErrorMessage handleException(ServiceDefinitionDoesNotExistException ex) Handle aServiceDefinitionDoesNotExistException
.- Parameters:
ex
- the exception- Returns:
- an error message
-
handleException
@ExceptionHandler(ServiceDefinitionPlanDoesNotExistException.class) @ResponseStatus(BAD_REQUEST) public ErrorMessage handleException(ServiceDefinitionPlanDoesNotExistException ex) - Parameters:
ex
- the exception- Returns:
- an error message
-
handleException
@ExceptionHandler(ServiceBrokerAsyncRequiredException.class) @ResponseStatus(UNPROCESSABLE_ENTITY) public ErrorMessage handleException(ServiceBrokerAsyncRequiredException ex) Handle aServiceBrokerAsyncRequiredException
.- Parameters:
ex
- the exception- Returns:
- an error message
-
handleException
@ExceptionHandler(ServiceBrokerMaintenanceInfoConflictException.class) @ResponseStatus(UNPROCESSABLE_ENTITY) public ErrorMessage handleException(ServiceBrokerMaintenanceInfoConflictException ex) - Parameters:
ex
- the exception- Returns:
- an error message
-
handleException
@ExceptionHandler(ServiceBrokerInvalidParametersException.class) @ResponseStatus(BAD_REQUEST) public ErrorMessage handleException(ServiceBrokerInvalidParametersException ex) Handle aServiceBrokerInvalidParametersException
.- Parameters:
ex
- the exception- Returns:
- an error message
-
handleException
@ExceptionHandler(ServiceBrokerOperationInProgressException.class) @ResponseStatus(NOT_FOUND) public ErrorMessage handleException(ServiceBrokerOperationInProgressException ex) - Parameters:
ex
- the exception- Returns:
- an error message
-
handleException
@ExceptionHandler(ServiceBrokerCreateOperationInProgressException.class) @ResponseStatus(ACCEPTED) public OperationInProgressMessage handleException(ServiceBrokerCreateOperationInProgressException ex) - Parameters:
ex
- the exception- Returns:
- an operation in progress message
-
handleException
@ExceptionHandler(ServiceBrokerUpdateOperationInProgressException.class) @ResponseStatus(ACCEPTED) public OperationInProgressMessage handleException(ServiceBrokerUpdateOperationInProgressException ex) - Parameters:
ex
- the exception- Returns:
- an operation in progress message
-
handleException
@ExceptionHandler(ServiceBrokerDeleteOperationInProgressException.class) @ResponseStatus(ACCEPTED) public OperationInProgressMessage handleException(ServiceBrokerDeleteOperationInProgressException ex) - Parameters:
ex
- the exception- Returns:
- an operation in progress message
-
handleException
@ExceptionHandler(ServiceBrokerConcurrencyException.class) @ResponseStatus(UNPROCESSABLE_ENTITY) public ErrorMessage handleException(ServiceBrokerConcurrencyException ex) Handle aServiceBrokerConcurrencyException
.- Parameters:
ex
- the exception- Returns:
- an error message
-
handleException
@ExceptionHandler(ServiceBrokerException.class) @ResponseStatus(INTERNAL_SERVER_ERROR) public ErrorMessage handleException(ServiceBrokerException ex) Handle aServiceBrokerException
.- Parameters:
ex
- the exception- Returns:
- an error message
-
handleException
@ExceptionHandler(ServiceBrokerInvalidOriginatingIdentityException.class) @ResponseStatus(UNPROCESSABLE_ENTITY) public ErrorMessage handleException(ServiceBrokerInvalidOriginatingIdentityException ex) - Parameters:
ex
- the exception- Returns:
- an error message
-
handleException
@ExceptionHandler(java.lang.Exception.class) @ResponseStatus(INTERNAL_SERVER_ERROR) public ErrorMessage handleException(Exception ex) Handle aException
.- Parameters:
ex
- the exception- Returns:
- an error message
-
handleException
@ExceptionHandler(ServiceInstanceExistsException.class) @ResponseStatus(CONFLICT) public ErrorMessage handleException(ServiceInstanceExistsException ex) Handle aServiceInstanceExistsException
.- Parameters:
ex
- the exception- Returns:
- an error message
-
handleException
@ExceptionHandler(ServiceInstanceUpdateNotSupportedException.class) @ResponseStatus(UNPROCESSABLE_ENTITY) public ErrorMessage handleException(ServiceInstanceUpdateNotSupportedException ex) - Parameters:
ex
- the exception- Returns:
- an error message
-
handleException
@ExceptionHandler(ServiceInstanceBindingExistsException.class) @ResponseStatus(CONFLICT) public ErrorMessage handleException(ServiceInstanceBindingExistsException ex) Handle aServiceInstanceBindingExistsException
.- Parameters:
ex
- the exception- Returns:
- an error message
-
handleException
@ExceptionHandler(ServiceInstanceBindingDoesNotExistException.class) @ResponseStatus(UNPROCESSABLE_ENTITY) public ErrorMessage handleException(ServiceInstanceBindingDoesNotExistException ex) - Parameters:
ex
- the exception- Returns:
- an error message
-
handleException
@ExceptionHandler(ServiceBrokerBindingRequiresAppException.class) @ResponseStatus(UNPROCESSABLE_ENTITY) public ErrorMessage handleException(ServiceBrokerBindingRequiresAppException ex) Handle aServiceBrokerBindingRequiresAppException
.- Parameters:
ex
- the exception- Returns:
- an error message
-
getErrorResponse
Format an error message for the exception.- Parameters:
ex
- the exception- Returns:
- the error message
-
getOperationInProgressMessage
protected OperationInProgressMessage getOperationInProgressMessage(ServiceBrokerOperationInProgressException ex) Format an operation in progress message for the exception.- Parameters:
ex
- the exception- Returns:
- the message
-
getErrorResponse
Format an error message for the exception.- Parameters:
ex
- the exception- Returns:
- the error message
-
getErrorResponse
Create an error message object.- Parameters:
message
- the text of the message- Returns:
- the error message
-
handleBindingException
Creates an error message for binding errors.- Parameters:
ex
- the exceptionresult
- the binding result- Returns:
- the error message
-