Enum Class Error

java.lang.Object
java.lang.Enum<Error>
edu.university.ecs.lab.common.error.Error
All Implemented Interfaces:
Serializable, Comparable<Error>, Constable

public enum Error extends Enum<Error>
Enum representing different error types with corresponding error codes and messages.
  • Enum Constant Details

    • UNKNOWN_ERROR

      public static final Error UNKNOWN_ERROR
    • NULL_ERROR

      public static final Error NULL_ERROR
    • INVALID_REPOSITORY_URL

      public static final Error INVALID_REPOSITORY_URL
    • INVALID_REPO_PATHS

      public static final Error INVALID_REPO_PATHS
    • INVALID_REPO_PATH

      public static final Error INVALID_REPO_PATH
    • INVALID_CONFIG_PATH

      public static final Error INVALID_CONFIG_PATH
    • REPO_DONT_EXIST

      public static final Error REPO_DONT_EXIST
    • GIT_FAILED

      public static final Error GIT_FAILED
    • INVALID_ARGS

      public static final Error INVALID_ARGS
    • INVALID_JSON_READ

      public static final Error INVALID_JSON_READ
    • INVALID_JSON_WRITE

      public static final Error INVALID_JSON_WRITE
    • JPARSE_FAILED

      public static final Error JPARSE_FAILED
    • INVALID_CONFIG

      public static final Error INVALID_CONFIG
    • MISSING_CONFIG

      public static final Error MISSING_CONFIG
  • Field Details

    • code

      private final int code
      The unique error code identifying the error type.
    • message

      private final String message
      The detailed message describing the error.
  • Constructor Details

    • Error

      private Error(int code, String message)
      Constructor for Error enum.
      Parameters:
      code - The error code.
      message - The error message.
  • Method Details

    • values

      public static Error[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Error valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • reportAndExit

      public static void reportAndExit(Error error, Optional<Exception> exception)
      Prints the error message to standard error and exits the program with the error code.
      Parameters:
      error - The error enum value to report and exit with.
    • toString

      public String toString()
      Returns a string representation of the error.
      Overrides:
      toString in class Enum<Error>
      Returns:
      The formatted string representation of the error.