Class CommonErrorHandler
java.lang.Object
com.skava.orchestration.processor.CommonErrorHandler
- All Implemented Interfaces:
org.apache.camel.Processor
@Service("commonErrorHandler")
public class CommonErrorHandler
extends Object
implements org.apache.camel.Processor
Instantiates a new common error handler.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
convertToError
(ErrorResponseModel errorResponseModel, String errorResponse) This method is used to convert the error response into error response model.convertToErrorModel
(String errorCode, String errorMessage) This method is used to set the error code and error message in the error response model.convertToErrorModelQty
(String errorCode, String errorMessage, Map<String, String> properties, String propertyName) This method is used to set the error code, error message and properties in the error response model.convertToLocalizedErrorModel
(String errorCode, String errorMessage, String locale) This method is used to set the localized error message and error code in the error response model.void
process
(org.apache.camel.Exchange exchange) void
validateError
(ErrorResponseModel errorResponseModel, EcommCustomErrorResponse validationErrorModel, String locale) This method is used to validate the error response model.
-
Constructor Details
-
CommonErrorHandler
public CommonErrorHandler()
-
-
Method Details
-
process
public void process(org.apache.camel.Exchange exchange) throws com.fasterxml.jackson.core.JsonProcessingException - Specified by:
process
in interfaceorg.apache.camel.Processor
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
- JsonProcessingException
-
convertToError
This method is used to convert the error response into error response model.- Parameters:
errorResponseModel
- Error Response modelerrorResponse
- Error response
-
validateError
public void validateError(ErrorResponseModel errorResponseModel, EcommCustomErrorResponse validationErrorModel, String locale) This method is used to validate the error response model.- Parameters:
errorResponseModel
- Error Response modelvalidationErrorModel
- Validation Error Modellocale
- locale
-
convertToErrorModel
This method is used to set the error code and error message in the error response model.- Parameters:
errorCode
- Error codeerrorMessage
- Error Message- Returns:
- Error string response
-
convertToErrorModelQty
public ErrorResponseModel convertToErrorModelQty(String errorCode, String errorMessage, Map<String, String> properties, String propertyName) This method is used to set the error code, error message and properties in the error response model.- Parameters:
errorCode
- which contains the error code detailserrorMessage
- which indicates the error message from the APIproperties
- which contains the propertiespropertyName
- which contains the property value- Returns:
- Error string response
-
convertToLocalizedErrorModel
public ErrorResponseModel convertToLocalizedErrorModel(String errorCode, String errorMessage, String locale) This method is used to set the localized error message and error code in the error response model.- Parameters:
errorCode
- Error codeerrorMessage
- Error Messagelocale
- the locale- Returns:
- Error string response
-