Enum Class ErrorCode

java.lang.Object
java.lang.Enum<ErrorCode>
codes.grow.packages.skywalking.core.ErrorCode
All Implemented Interfaces:
Serializable, Comparable<ErrorCode>, Constable

public enum ErrorCode extends Enum<ErrorCode>
Canonical error codes shared by every Grow Codes SDK (SPEC section 2.1).
  • Enum Constant Details

    • CONFIG

      public static final ErrorCode CONFIG
      Invalid or missing configuration.
    • AUTHENTICATION

      public static final ErrorCode AUTHENTICATION
      HTTP 401: missing or invalid credentials.
    • PERMISSION_DENIED

      public static final ErrorCode PERMISSION_DENIED
      HTTP 403: the credentials lack a permission.
    • NOT_FOUND

      public static final ErrorCode NOT_FOUND
      HTTP 404 or a missing record.
    • CONFLICT

      public static final ErrorCode CONFLICT
      HTTP 409, 412 or a check-and-set mismatch.
    • RATE_LIMITED

      public static final ErrorCode RATE_LIMITED
      HTTP 429.
    • VALIDATION

      public static final ErrorCode VALIDATION
      HTTP 400, 413, 422, other 4xx or bad input caught client side.
    • UNAVAILABLE

      public static final ErrorCode UNAVAILABLE
      Network error or HTTP 500, 502, 503.
    • TIMEOUT

      public static final ErrorCode TIMEOUT
      Connect, request or total deadline exceeded, HTTP 408 or 504.
    • UNSUPPORTED

      public static final ErrorCode UNSUPPORTED
      A capability the service or deployment does not offer (HTTP 501).
    • CANCELLED

      public static final ErrorCode CANCELLED
      The caller cancelled the operation.
  • Method Details

    • values

      public static ErrorCode[] 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 ErrorCode 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
    • retryable

      public boolean retryable()
      Returns whether errors with this code are retryable by default.
      Returns:
      true for RATE_LIMITED, UNAVAILABLE and TIMEOUT
    • wireValue

      public String wireValue()
      Returns the wire value used in conformance scenarios and JSON.
      Returns:
      the upper-case wire value, e.g. NOT_FOUND
    • of

      public static Optional<ErrorCode> of(Throwable error)
      Returns the code of an SDK exception.
      Parameters:
      error - any throwable
      Returns:
      the code when error is an SDK exception, else empty
    • forStatus

      public static ErrorCode forStatus(int status)
      Maps an HTTP status to its canonical code.
      Parameters:
      status - HTTP status code (4xx or 5xx)
      Returns:
      the code per SPEC section 2.1