Package org.forgerock.openig.fapi.error
Class ErrorResponseUtils
java.lang.Object
org.forgerock.openig.fapi.error.ErrorResponseUtils
Generic utility class which creates
Response objects for error during FAPI requests.-
Method Summary
Modifier and TypeMethodDescriptionstatic ResponseerrorResponse(String errorCode, String errorDescription) Build aResponsefrom the supplied error code and description.static ResponseerrorResponse(Status status, String error, String errorDescription) static ResponseerrorResponse(Status status, String error, String errorDescription, Map<String, Object> additionalFields) Utility method to build errorResponse.static ResponseerrorResponse(FapiException fapiException) Build aResponsefrom the suppliedFapiException.static Promise<Response, NeverThrowsException> errorResponseAsync(String errorCode, String errorDescription) static Promise<Response, NeverThrowsException> errorResponseAsync(Status status, String error, Exception exception) static Promise<Response, NeverThrowsException> errorResponseAsync(Status status, String error, String errorDescription) static Promise<Response, NeverThrowsException> errorResponseAsync(FapiException fapiException)
-
Method Details
-
errorResponse
Build aResponsefrom the suppliedFapiException.- Parameters:
fapiException- the exception used to extract error code and description- Returns:
- the
Response
-
errorResponseAsync
public static Promise<Response,NeverThrowsException> errorResponseAsync(FapiException fapiException) - Parameters:
fapiException- the exception used to extract error code and description- Returns:
- the
Response
-
errorResponseAsync
public static Promise<Response,NeverThrowsException> errorResponseAsync(String errorCode, String errorDescription) Build aPromiseof aResponsefrom the supplied error code and description. The response status will beStatus.BAD_REQUEST. -
errorResponse
Build aResponsefrom the supplied error code and description. The response status will beStatus.BAD_REQUEST.- Parameters:
errorCode- the error code to use in the responseerrorDescription- the error description to use in the response- Returns:
- the
Response
-
errorResponseAsync
-
errorResponseAsync
public static Promise<Response,NeverThrowsException> errorResponseAsync(Status status, String error, Exception exception) -
errorResponse
-
errorResponse
public static Response errorResponse(Status status, String error, String errorDescription, Map<String, Object> additionalFields) Utility method to build errorResponse.- Parameters:
status- the error response HTTPStatuserror- the error field to use in the response - notnullerrorDescription- the error_description field to use in the response - optionaladditionalFields- any additional fields to add to the response. Anyerrororerror_descriptionfields would be ignored.- Returns:
- the
Response
-