java.lang.Object
se.idsec.signservice.integration.core.error.ErrorCode
All Implemented Interfaces:
Serializable

public class ErrorCode extends Object implements 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:
  • Field Details

  • Constructor Details

    • ErrorCode

      public ErrorCode(String errorCode)
      Constructor taking a complete error code string on the format "error.category.code".
      Parameters:
      errorCode - the error code in string format
    • ErrorCode

      public ErrorCode(String category, String code)
      Constructor taking the category and the code.
      Parameters:
      category - the error category
      code - 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

      public static ErrorCode error(String category, String code)
      Utility method for creating an ErrorCode.
      Parameters:
      category - the category
      code - the code within the category
      Returns:
      an ErrorCode
    • getCategory

      public String getCategory()
      Gets the category of the error.
      Returns:
      the category
    • getCode

      public String getCode()
      Gets the error code within the given category.
      Returns:
      the code
    • getErrorCode

      public String getErrorCode()
      Gets the error code in string representation.
      Returns:
      the error code
    • toString

      public String toString()
      Overrides:
      toString in class Object