Class ErrorsHelper
java.lang.Object
com.oracle.coherence.grpc.ErrorsHelper
Error helper methods.
- Since:
- 20.06
- Author:
- Jonathan Knight 2019.11.28
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic com.oracle.coherence.grpc.messages.common.v1.ErrorMessagecreateErrorMessage(Throwable error, Serializer serializer) Create anErrorMessagefrom aThrowable.static com.oracle.coherence.grpc.messages.common.v1.ErrorMessagecreateErrorMessage(Throwable error, Serializer serializer, String sErrorDisclosure) Create anErrorMessagefrom aThrowable.static RequestIncompleteExceptioncreateException(com.oracle.coherence.grpc.messages.common.v1.ErrorMessage error, Serializer serializer) Create aRequestIncompleteExceptionfrom anErrorMessage.static <E extends Exception>
EcreateException(com.oracle.coherence.grpc.messages.common.v1.ErrorMessage error, Serializer serializer, BiFunction<String, Throwable, E> factory) Create an exception from anErrorMessage.static io.grpc.StatusRuntimeExceptionConvert aThrowableto aStatusRuntimeException.static io.grpc.StatusRuntimeExceptionensureStatusRuntimeException(Throwable t, String description) Convert aThrowableto aStatusRuntimeException.static io.grpc.StatusRuntimeExceptionensureStatusRuntimeException(Throwable t, String description, String sErrorDisclosure) Convert aThrowableto aStatusRuntimeException.static io.grpc.StatusRuntimeExceptionensureStatusRuntimeExceptionWithPolicy(Throwable t, String sErrorDisclosure) Convert aThrowableto aStatusRuntimeException.getRemoteStack(io.grpc.StatusException e) Obtain the remote stack trace from the specifiedStatusException.getRemoteStack(io.grpc.StatusRuntimeException e) Obtain the remote stack trace from the specifiedStatusRuntimeException.static voidLog the exception unless it is aStatusRuntimeExceptionwith a status ofStatus.CANCELLED.
-
Field Details
-
KEY_ERROR
The metadata key for an exception stack trace. -
SAFE_INTERNAL_ERROR_MESSAGE
Bounded generic message for unhandled internal errors in safe mode.- See Also:
-
-
Method Details
-
ensureStatusRuntimeException
-
ensureStatusRuntimeExceptionWithPolicy
-
ensureStatusRuntimeException
-
ensureStatusRuntimeException
public static io.grpc.StatusRuntimeException ensureStatusRuntimeException(Throwable t, String description, String sErrorDisclosure) Convert aThrowableto aStatusRuntimeException.- Parameters:
t- theThrowableto convertdescription- the description to add to the exceptionsErrorDisclosure- the gRPC error-disclosure policy- Returns:
- a
StatusRuntimeException
-
getRemoteStack
-
getRemoteStack
-
createException
public static RequestIncompleteException createException(com.oracle.coherence.grpc.messages.common.v1.ErrorMessage error, Serializer serializer) Create aRequestIncompleteExceptionfrom anErrorMessage.- Parameters:
error- theErrorMessageserializer- theSerializerto deserialize the stack trace- Returns:
- the
RequestIncompleteExceptioncreated from theErrorMessage
-
createException
public static <E extends Exception> E createException(com.oracle.coherence.grpc.messages.common.v1.ErrorMessage error, Serializer serializer, BiFunction<String, Throwable, E> factory) Create an exception from anErrorMessage.- Type Parameters:
E- the type of exception to return- Parameters:
error- theErrorMessageserializer- theSerializerto deserialize the stack tracefactory- the factory function to create the resulting exception- Returns:
- the exception created from the
ErrorMessage
-
createErrorMessage
public static com.oracle.coherence.grpc.messages.common.v1.ErrorMessage createErrorMessage(Throwable error, Serializer serializer) Create anErrorMessagefrom aThrowable.- Parameters:
error- the error to create the message fromserializer- the serializer to use to serialize the stack trace- Returns:
- the error message
-
createErrorMessage
public static com.oracle.coherence.grpc.messages.common.v1.ErrorMessage createErrorMessage(Throwable error, Serializer serializer, String sErrorDisclosure) Create anErrorMessagefrom aThrowable.- Parameters:
error- the error to create the message fromserializer- the serializer to use to serialize the stack tracesErrorDisclosure- the gRPC error-disclosure policy- Returns:
- the error message
-
logIfNotCancelled
Log the exception unless it is aStatusRuntimeExceptionwith a status ofStatus.CANCELLED.- Parameters:
t- the exception to log
-