public UnframedGrpcErrorHandler build() {
        if (jsonMarshaller == null) {
            jsonMarshaller = JsonUnframedGrpcErrorHandler.ERROR_DETAILS_MARSHALLER;
            final MessageMarshaller.Builder builder = jsonMarshaller.toBuilder();

            if (marshalledMessages != null) {
                for (final Message message : marshalledMessages) {
                    builder.register(message);
                }
            }

            if (marshalledMessageTypes != null) {
                for (final Class<? extends Message> messageType : marshalledMessageTypes) {
                    builder.register(messageType);
                }
            }

            jsonMarshaller = builder.build();
        }

        if (responseTypes == null) {
            return DefaultUnframedGrpcErrorHandler.of(statusMappingFunction, jsonMarshaller);
        }

        if (responseTypes.contains(UnframedGrpcErrorResponseType.JSON) &&
            responseTypes.contains(UnframedGrpcErrorResponseType.PLAINTEXT)) {
            return DefaultUnframedGrpcErrorHandler.of(statusMappingFunction, jsonMarshaller);
        }

        if (responseTypes.contains(UnframedGrpcErrorResponseType.JSON)) {
            return JsonUnframedGrpcErrorHandler.of(statusMappingFunction, jsonMarshaller);
        }

        if (responseTypes.contains(UnframedGrpcErrorResponseType.PLAINTEXT)) {
            return TextUnframedGrpcErrorHandler.of(statusMappingFunction);
        }

        return DefaultUnframedGrpcErrorHandler.of(statusMappingFunction, jsonMarshaller);
    }
Returns a newly created {@link UnframedGrpcErrorHandler}.

<p>This method constructs a new {@code UnframedGrpcErrorHandler} with the
current configuration of this builder.
grpc/src/main/java/com/linecorp/armeria/server/grpc/UnframedGrpcErrorHandlerBuilder.java