Class GrpcErrorStatusMapping.Builder
java.lang.Object
io.superdurable.dex.GrpcErrorStatusMapping.Builder
- Enclosing class:
GrpcErrorStatusMapping
Builds immutable exception-to-status mappings.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds an immutable mapping from the current entries.Maps an exception class and its otherwise-unmapped subclasses to a gRPC status.
-
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 matchstatus- the nonnull, non-OKgRPC status code to store with matching Worker errors- Returns:
- this builder
- Throws:
IllegalArgumentException- if either argument isnullorstatusisStatus.Code.OK
-
build
Builds an immutable mapping from the current entries.- Returns:
- the configured mapping, using
INTERNALfor unmatched exceptions
-