public GrpcExceptionHandlerFunctionBuilder on(Class<? extends Throwable> exceptionType,
                                                  GrpcExceptionHandlerFunction exceptionHandler) {
        requireNonNull(exceptionType, "exceptionType");
        requireNonNull(exceptionHandler, "exceptionHandler");

        final ListIterator<Entry<Class<? extends Throwable>, GrpcExceptionHandlerFunction>> it =
                exceptionMappings.listIterator();

        while (it.hasNext()) {
            final Map.Entry<Class<? extends Throwable>, GrpcExceptionHandlerFunction> next = it.next();
            final Class<? extends Throwable> oldExceptionType = next.getKey();
            checkArgument(oldExceptionType != exceptionType, "%s is already added with %s",
                          oldExceptionType, next.getValue());

            if (oldExceptionType.isAssignableFrom(exceptionType)) {
                // exceptionType is a subtype of oldExceptionType. exceptionType needs a higher priority.
                it.previous();
                it.add(Maps.immutableEntry(exceptionType, exceptionHandler));
                return this;
            }
        }

        exceptionMappings.add(Maps.immutableEntry(exceptionType, exceptionHandler));
        return this;
    }
Adds the specified exception mapping that maps a {@link Throwable} to a gRPC {@link Status}.
The mapping is used to handle a {@link Throwable} when it is raised.
grpc/src/main/java/com/linecorp/armeria/common/grpc/GrpcExceptionHandlerFunctionBuilder.java