Class RPCExceptionUtil
java.lang.Object
eu.cloudnetservice.driver.impl.network.rpc.handler.util.RPCExceptionUtil
An internal utility class to communicate serialized exceptions thrown during RPC handling to the calling component.
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final Stringstatic final StackTraceElement[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidrethrowHandlingException(@NonNull eu.cloudnetservice.driver.network.buffer.DataBuf source) Rethrows the exception that is serialized in the given buffer, wrapped in anRPCExecutionException.static @NonNull eu.cloudnetservice.driver.network.buffer.DataBufserializeHandlingException(eu.cloudnetservice.driver.network.buffer.DataBuf.Mutable target, @NonNull Throwable throwable) Serializes the thrown handling exception into the given target data buffer.private static voidserializeStacktraceElement(eu.cloudnetservice.driver.network.buffer.DataBuf.Mutable target, @NonNull StackTraceElement element) Serializes a single stacktrace element into the given target data buffer.
-
Field Details
-
UNASSIGNED_STACK
-
RPC_LISTENER_HANDLE_METHOD
- See Also:
-
RPC_LISTENER_CLASS_BIN_NAME
-
-
Constructor Details
-
RPCExceptionUtil
private RPCExceptionUtil()
-
-
Method Details
-
serializeHandlingException
@Contract("_, _ -> param1") @NonNull public static @NonNull eu.cloudnetservice.driver.network.buffer.DataBuf serializeHandlingException(@NonNull eu.cloudnetservice.driver.network.buffer.DataBuf.Mutable target, @NonNull @NonNull Throwable throwable) Serializes the thrown handling exception into the given target data buffer.- Parameters:
target- the buffer to serialize the exception into.throwable- the throwable to serialize.- Returns:
- the given buffer, for chaining.
- Throws:
NullPointerException- if the given buffer or throwable is null.
-
rethrowHandlingException
@Contract("_ -> fail") public static void rethrowHandlingException(@NonNull @NonNull eu.cloudnetservice.driver.network.buffer.DataBuf source) Rethrows the exception that is serialized in the given buffer, wrapped in anRPCExecutionException. This method never returns, it always throws an exception.- Parameters:
source- the buffer to read the exception information from.- Throws:
NullPointerException- if the given source is null.eu.cloudnetservice.driver.network.rpc.exception.RPCExecutionException- to rethrow the serialized exception, always.
-
serializeStacktraceElement
private static void serializeStacktraceElement(@NonNull eu.cloudnetservice.driver.network.buffer.DataBuf.Mutable target, @NonNull @NonNull StackTraceElement element) Serializes a single stacktrace element into the given target data buffer.- Parameters:
target- the buffer to serialize the stack element into.element- the stack element to serialize.- Throws:
NullPointerException- if the given target buffer or stack element is null.
-