Class GrpcStatus

java.lang.Object
com.codename1.backend.grpc.GrpcStatus

public final class GrpcStatus extends Object

The gRPC status codes, as they travel in the grpc-status trailer.

The numbers are the wire values from the gRPC specification and never change; the names are the ones every gRPC implementation prints, so a log line here reads the same as one from the peer.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The call was aborted, typically by a concurrency conflict.
    static final int
    The entity the caller tried to create already exists.
    static final int
    The call was cancelled, usually by the caller.
    static final int
    Data was lost or corrupted.
    static final int
    The deadline passed before the call completed.
    static final int
    The system is not in the state the call requires.
    static final int
    An invariant the server relies on was broken.
    static final int
    The caller sent an argument that is invalid whatever the server's state.
    static final int
    The requested entity does not exist.
    static final int
    Not an error: the call completed.
    static final int
    A value was outside the valid range.
    static final int
    The caller is not allowed to do this.
    static final int
    A resource, such as a quota or a message size limit, ran out.
    static final int
    The caller has no valid credentials.
    static final int
    The service is currently unavailable; a retry may succeed.
    static final int
    The method is not implemented by this server.
    static final int
    An error that fits no other code.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    fromHttpStatus(int httpStatus)
    The status a gRPC client must report for an HTTP response that carried no grpc-status at all, per the gRPC "HTTP to gRPC status code mapping".
    static String
    name(int code)
    The conventional name of a code, or CODE_<n> for one outside the table.
    static int
    parse(String value)
    Parses a grpc-status value.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • OK

      public static final int OK
      Not an error: the call completed.
      See Also:
    • CANCELLED

      public static final int CANCELLED
      The call was cancelled, usually by the caller.
      See Also:
    • UNKNOWN

      public static final int UNKNOWN
      An error that fits no other code.
      See Also:
    • INVALID_ARGUMENT

      public static final int INVALID_ARGUMENT
      The caller sent an argument that is invalid whatever the server's state.
      See Also:
    • DEADLINE_EXCEEDED

      public static final int DEADLINE_EXCEEDED
      The deadline passed before the call completed.
      See Also:
    • NOT_FOUND

      public static final int NOT_FOUND
      The requested entity does not exist.
      See Also:
    • ALREADY_EXISTS

      public static final int ALREADY_EXISTS
      The entity the caller tried to create already exists.
      See Also:
    • PERMISSION_DENIED

      public static final int PERMISSION_DENIED
      The caller is not allowed to do this.
      See Also:
    • RESOURCE_EXHAUSTED

      public static final int RESOURCE_EXHAUSTED
      A resource, such as a quota or a message size limit, ran out.
      See Also:
    • FAILED_PRECONDITION

      public static final int FAILED_PRECONDITION
      The system is not in the state the call requires.
      See Also:
    • ABORTED

      public static final int ABORTED
      The call was aborted, typically by a concurrency conflict.
      See Also:
    • OUT_OF_RANGE

      public static final int OUT_OF_RANGE
      A value was outside the valid range.
      See Also:
    • UNIMPLEMENTED

      public static final int UNIMPLEMENTED
      The method is not implemented by this server.
      See Also:
    • INTERNAL

      public static final int INTERNAL
      An invariant the server relies on was broken.
      See Also:
    • UNAVAILABLE

      public static final int UNAVAILABLE
      The service is currently unavailable; a retry may succeed.
      See Also:
    • DATA_LOSS

      public static final int DATA_LOSS
      Data was lost or corrupted.
      See Also:
    • UNAUTHENTICATED

      public static final int UNAUTHENTICATED
      The caller has no valid credentials.
      See Also:
  • Method Details

    • name

      public static String name(int code)
      The conventional name of a code, or CODE_<n> for one outside the table.
      Parameters:
      code - a gRPC status code
      Returns:
      its name
    • fromHttpStatus

      public static int fromHttpStatus(int httpStatus)
      The status a gRPC client must report for an HTTP response that carried no grpc-status at all, per the gRPC "HTTP to gRPC status code mapping".
      Parameters:
      httpStatus - the HTTP status of the response
      Returns:
      the gRPC code to report
    • parse

      public static int parse(String value)
      Parses a grpc-status value. Anything that is not a plain decimal number is a peer speaking something other than gRPC, reported as UNKNOWN.
      Parameters:
      value - the trailer value, possibly null
      Returns:
      the code, or UNKNOWN when the value is missing or malformed