public GrpcExceptionHandlerFunction build() {
        checkState(!exceptionMappings.isEmpty(), "no exception handler is added.");

        final List<Entry<Class<? extends Throwable>, GrpcExceptionHandlerFunction>> mappings =
                ImmutableList.copyOf(exceptionMappings);
        return (ctx, status, cause, metadata) -> {
            for (Map.Entry<Class<? extends Throwable>, GrpcExceptionHandlerFunction> mapping : mappings) {
                if (mapping.getKey().isInstance(cause)) {
                    final Status newStatus = mapping.getValue().apply(ctx, status, cause, metadata);
                    return newStatus == null ? null : newStatus.withCause(cause);
                }
            }
            return null;
        };
    }
Returns a newly created {@link GrpcExceptionHandlerFunction} based on the mappings added to this builder.
grpc/src/main/java/com/linecorp/armeria/common/grpc/GrpcExceptionHandlerFunctionBuilder.java