Class AppException

    • Constructor Detail

      • AppException

        public AppException​(ErrorCode errorCode,
                            String errorMessage)
        Create an error caused by an error in the protocol when communicating with the Object Server.
        Parameters:
        errorCode - error code for this type of error.
        errorMessage - detailed error message.
      • AppException

        public AppException​(String errorType,
                            int errorCode,
                            String errorMessage)
        Creates an unknown error that could not be mapped to any known error case.

        This means that getErrorCode() will return ErrorCode.UNKNOWN, but getErrorType() and getErrorIntValue() will return the underlying values which can help identify the real error.

        Parameters:
        errorCode - error code for this type of error.
        errorMessage - detailed error message.
      • AppException

        public AppException​(ErrorCode errorCode,
                            Throwable exception)
        Create an error caused by an an exception when communicating with the Object Server.
        Parameters:
        errorCode - error code for this type of error.
        exception - underlying exception causing this error.
      • AppException

        public AppException​(ErrorCode errorCode,
                            String title,
                            @Nullable
                            String hint)
        Errors happening while trying to authenticate a user.
        Parameters:
        errorCode - error code for this type of error.
        title - title for this type of error.
        hint - a hint for resolving the error.
      • AppException

        public AppException​(ErrorCode errorCode,
                            @Nullable
                            String errorMessage,
                            @Nullable
                            Throwable exception)
        Generic error happening that could happen anywhere.
        Parameters:
        errorCode - error code for this type of error.
        errorMessage - detailed error message.
        exception - underlying exception if the error was caused by this.
    • Method Detail

      • getErrorCode

        public ErrorCode getErrorCode()
        Returns the ErrorCode identifying the type of error.

        If ErrorCode.UNKNOWN is returned, it means that the error could not be mapped to any known errors. In that case getErrorType() and getErrorIntValue() will return the underlying error information which can better identify the type of error.

        Returns:
        the error code identifying the type of error.
        See Also:
        ErrorCode
      • getErrorType

        public String getErrorType()
        Returns a string describing the type of error it is.
        Returns:
      • getErrorIntValue

        public int getErrorIntValue()
        Returns an integer representing this specific type of error. This value is only unique within the value provided by getErrorType().
        Returns:
        the integer value representing this type of error.
      • getErrorMessage

        @Nullable
        public String getErrorMessage()
        Returns a more detailed error message about the cause of this error.
        Returns:
        a detailed error message or null if one was not available.
      • getException

        @Nullable
        public Throwable getException()
        Returns the underlying exception causing this error, if any.
        Returns:
        the underlying exception causing this error, or null if not caused by an exception.