Class GrpcErrorStatusMapping.Builder

java.lang.Object
io.superdurable.dex.GrpcErrorStatusMapping.Builder
Enclosing class:
GrpcErrorStatusMapping

public static final class GrpcErrorStatusMapping.Builder extends Object
Builds immutable exception-to-status mappings.
  • Method Details

    • map

      public GrpcErrorStatusMapping.Builder map(Class<? extends Throwable> exceptionType, io.grpc.Status.Code status)
      Maps an exception class and its otherwise-unmapped subclasses to a gRPC status.

      Calling this method again for the same class replaces its previous status. A mapping for a subclass takes precedence over a mapping inherited from a superclass.

      Parameters:
      exceptionType - the nonnull exception or error class to match
      status - the nonnull, non-OK gRPC status code to store with matching Worker errors
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if either argument is null or status is Status.Code.OK
    • build

      public GrpcErrorStatusMapping build()
      Builds an immutable mapping from the current entries.
      Returns:
      the configured mapping, using INTERNAL for unmatched exceptions