Class RPCExceptionUtil

java.lang.Object
eu.cloudnetservice.driver.impl.network.rpc.handler.util.RPCExceptionUtil

public final class RPCExceptionUtil extends Object
An internal utility class to communicate serialized exceptions thrown during RPC handling to the calling component.
Since:
4.0
  • Field Details

    • UNASSIGNED_STACK

      public static final StackTraceElement[] UNASSIGNED_STACK
    • RPC_LISTENER_HANDLE_METHOD

      private static final String RPC_LISTENER_HANDLE_METHOD
      See Also:
    • RPC_LISTENER_CLASS_BIN_NAME

      private static final String 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 an RPCExecutionException. 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.