Enum ErrorCode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<ErrorCode>

    public enum ErrorCode
    extends java.lang.Enum<ErrorCode>
    Strongly-typed error codes for Java-side errors with compile-time safety. Each error code has an associated HTTP status from the HttpStatus enum.
    • Enum Constant Detail

      • INVALID_ARGUMENT

        public static final ErrorCode INVALID_ARGUMENT
      • CLOSED_CHANNEL_ERROR

        public static final ErrorCode CLOSED_CHANNEL_ERROR
      • CLOSED_CLIENT_ERROR

        public static final ErrorCode CLOSED_CLIENT_ERROR
      • INVALID_CHANNEL_ERROR

        public static final ErrorCode INVALID_CHANNEL_ERROR
      • SERIALIZATION_ERROR

        public static final ErrorCode SERIALIZATION_ERROR
      • TOKEN_CHECKER_ERROR

        public static final ErrorCode TOKEN_CHECKER_ERROR
    • Method Detail

      • values

        public static ErrorCode[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (ErrorCode c : ErrorCode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ErrorCode valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getErrorCodeName

        public java.lang.String getErrorCodeName()
        Get the error code name (e.g., "InvalidArgument")
      • getHttpStatusCode

        public int getHttpStatusCode()
        Get the HTTP status code (e.g., 400)
      • getHttpStatusName

        public java.lang.String getHttpStatusName()
        Get the HTTP status name (e.g., "Bad Request")
      • fromString

        public static ErrorCode fromString​(java.lang.String errorCodeName)
        Find an ErrorCode by its string name
        Parameters:
        errorCodeName - the error code name to look up
        Returns:
        the matching ErrorCode, or null if not found