public GracefulShutdownBuilder toExceptionFunction(
            BiFunction<? super ServiceRequestContext, ? super HttpRequest, ? extends Throwable> toException) {
        requireNonNull(toException, "toException");
        //noinspection unchecked
        this.toException = (BiFunction<ServiceRequestContext, HttpRequest, Throwable>) toException;
        return this;
    }
Sets the function that returns an {@link Throwable} to terminate a pending request when the server is
shutting down. If unspecified, the request will be terminated with {@link ShuttingDownException} that
will be converted to an {@link HttpStatus#SERVICE_UNAVAILABLE} response.
core/src/main/java/com/linecorp/armeria/server/GracefulShutdownBuilder.java