Class ErrorCode
java.lang.Object
se.idsec.signservice.integration.core.error.ErrorCode
- All Implemented Interfaces:
Serializable
When using the SignService Integration Service via a REST API we report errors using error codes (and of course
messages). This class defines the structure of the error codes used.
All errors are prefixed with "error."
followed by the category of the error, for example bad-request
and the ends with the actual error, for example missing-policy
. In string format this error is then displayed
as error.bad-request.missing-policy
.
- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A typed category (for use in exceptions).static class
A typed code (for use in exceptions). -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
ERROR_CODE_PREFIX
Prefix for all errors.- See Also:
-
-
Constructor Details
-
ErrorCode
Constructor taking a complete error code string on the format "error.category.code".- Parameters:
errorCode
- the error code in string format
-
ErrorCode
Constructor taking the category and the code.- Parameters:
category
- the error categorycode
- the code within the category
-
ErrorCode
protected ErrorCode()Default constructor.Protected since it shouldn't be used by others than JSON deserializers.
-
-
Method Details
-
error
Utility method for creating anErrorCode
.- Parameters:
category
- the categorycode
- the code within the category- Returns:
- an ErrorCode
-
getCategory
Gets the category of the error.- Returns:
- the category
-
getCode
Gets the error code within the given category.- Returns:
- the code
-
getErrorCode
Gets the error code in string representation.- Returns:
- the error code
-
toString
-