Class GrpcException


public class GrpcException extends RuntimeException

A failed gRPC call: a status code other than GrpcStatus.OK and the message that goes with it.

A server handler throws it to end a call with that status; the client throws it when a call ends with one. Any other exception a handler throws is reported to the caller as GrpcStatus.UNKNOWN with no message, so that an internal error text never leaks to a peer by accident.

  • Constructor Details

    • GrpcException

      public GrpcException(int status, String message)
      Parameters:
      status - a gRPC status code, see GrpcStatus
      message - the human-readable status message, may be null
    • GrpcException

      public GrpcException(int status, String message, Throwable cause)
      Parameters:
      status - a gRPC status code, see GrpcStatus
      message - the human-readable status message, may be null
      cause - the underlying failure
  • Method Details

    • getStatus

      public int getStatus()
      Returns:
      the gRPC status code
    • toString

      public String toString()
      Description copied from class: Throwable
      Returns a short description of this Throwable object. If this Throwable object was with an error message string, then the result is the concatenation of three strings: The name of the actual class of this object ": " (a colon and a space) The result of the method for this object If this Throwable object was with no error message string, then the name of the actual class of this object is returned.
      Overrides:
      toString in class Throwable