@Override
    public HttpResponse handle(ServiceRequestContext ctx, Status status, AggregatedHttpResponse response) {
        final Code grpcCode = status.getCode();
        final String grpcMessage = status.getDescription();
        final Throwable cause = responseCause(ctx);
        final HttpStatus httpStatus = statusMappingFunction.apply(ctx, status, cause);
        assert httpStatus != null : "Default statusMappingFunction returned null?";
        final ResponseHeaders responseHeaders = ResponseHeaders.builder(httpStatus)
                                                               .contentType(MediaType.PLAIN_TEXT_UTF_8)
                                                               .addInt(GrpcHeaderNames.GRPC_STATUS,
                                                                       grpcCode.value())
                                                               .build();
        final HttpData content;
        try (TemporaryThreadLocals ttl = TemporaryThreadLocals.acquire()) {
            final StringBuilder msg = ttl.stringBuilder();
            msg.append("grpc-code: ").append(grpcCode.name());
            if (grpcMessage != null) {
                msg.append(", ").append(grpcMessage);
            }
            if (cause != null && ctx.config().verboseResponses()) {
                msg.append("\nstack-trace:\n").append(Exceptions.traceText(cause));
            }
            content = HttpData.ofUtf8(msg);
        }
        return HttpResponse.of(responseHeaders, content);
    }
Returns a plaintext response.

@param ctx the service context.
@param status the gRPC {@link Status} code.
@param response the gRPC response.

@return the {@link HttpResponse}.
grpc/src/main/java/com/linecorp/armeria/server/grpc/TextUnframedGrpcErrorHandler.java