- All Implemented Interfaces:
Serializable
Base exception class used to report gRPC errors.
- Since:
- 1.9
- Author:
- Jeremy Kuhn
- See Also:
-
Constructor Summary
ConstructorDescriptionCreates a gRPC exception with default statusGrpcStatus.INTERNAL
.GrpcException
(int statusCode) Creates a gRPC exception with specified gRPC status code.GrpcException
(int statusCode, String message) Creates a gRPC exception with specified gRPC status code and message.GrpcException
(int statusCode, String message, Throwable cause) Creates a gRPC exception with specified gRPC status code, message and cause.GrpcException
(int statusCode, Throwable cause) Creates a gRPC exception with specified gRPC status code and cause.GrpcException
(GrpcStatus status) Creates a gRPC exception with specified gRPC status.GrpcException
(GrpcStatus status, String message) Creates a gRPC exception with specified gRPC status and message.GrpcException
(GrpcStatus status, String message, Throwable cause) Creates a gRPC exception with specified gRPC status, message and cause.GrpcException
(GrpcStatus status, Throwable cause) Creates a gRPC exception with specified gRPC status and cause.GrpcException
(String message) Creates a gRPC exception with default statusGrpcStatus.INTERNAL
and specified message.GrpcException
(String message, Throwable cause) Creates a gRPC exception with default statusGrpcStatus.INTERNAL
, specified message and cause.GrpcException
(Throwable cause) Creates a gRPC exception with default statusGrpcStatus.INTERNAL
and specified cause. -
Method Summary
Modifier and TypeMethodDescriptionReturns the gRPC status.int
Returns the gRPC status code.static GrpcException
Wraps the specified error into an GrpcException.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
GrpcException
public GrpcException()Creates a gRPC exception with default status
GrpcStatus.INTERNAL
. -
GrpcException
Creates a gRPC exception with default status
GrpcStatus.INTERNAL
and specified message.- Parameters:
message
- a message
-
GrpcException
Creates a gRPC exception with default status
GrpcStatus.INTERNAL
and specified cause.- Parameters:
cause
- a cause
-
GrpcException
Creates a gRPC exception with default status
GrpcStatus.INTERNAL
, specified message and cause.- Parameters:
message
- a messagecause
- a cause
-
GrpcException
Creates a gRPC exception with specified gRPC status code.
- Parameters:
statusCode
- a gRPC status code- Throws:
IllegalArgumentException
- if the specified status code is invalid
-
GrpcException
Creates a gRPC exception with specified gRPC status code and message.
- Parameters:
statusCode
- a gRPC status codemessage
- a message- Throws:
IllegalArgumentException
- if the specified status code is invalid
-
GrpcException
Creates a gRPC exception with specified gRPC status code and cause.
- Parameters:
statusCode
- a gRPC status codecause
- a cause- Throws:
IllegalArgumentException
- if the specified status code is invalid
-
GrpcException
public GrpcException(int statusCode, String message, Throwable cause) throws IllegalArgumentException Creates a gRPC exception with specified gRPC status code, message and cause.
- Parameters:
statusCode
- a gRPC status codemessage
- a messagecause
- a cause- Throws:
IllegalArgumentException
- if the specified status code is invalid
-
GrpcException
Creates a gRPC exception with specified gRPC status.
- Parameters:
status
- a gRPC status
-
GrpcException
Creates a gRPC exception with specified gRPC status and message.
- Parameters:
status
- a gRPC statusmessage
- a message
-
GrpcException
Creates a gRPC exception with specified gRPC status and cause.
- Parameters:
status
- a gRPC statuscause
- a cause
-
GrpcException
Creates a gRPC exception with specified gRPC status, message and cause.
- Parameters:
status
- a gRPC statusmessage
- a messagecause
- a cause
-
-
Method Details
-
getStatusCode
public int getStatusCode()Returns the gRPC status code.
- Returns:
- a gRPC status code
-
getStatus
Returns the gRPC status.
- Returns:
- a gRPC status or null if the code specified does correspond to any known status
-
wrap
Wraps the specified error into an GrpcException.
The specified error is returned untouched if it is already an
GrpcException
instance, ohterwise it is wrapped in aGrpcException
withGrpcStatus.INTERNAL
code.- Parameters:
error
- the error to wrap- Returns:
- the specified error if it is a
GrpcException
, aGrpcException
wrapping the specified error otherwise
-