private HttpResponse convertResponseInternal(ServiceRequestContext ctx,
                                                 ResponseHeaders headers,
                                                 @Nullable Object result,
                                                 HttpHeaders trailers) {
        if (result instanceof CompletionStage) {
            final CompletionStage<?> future = (CompletionStage<?>) result;
            return HttpResponse.of(
                    future.thenApply(object -> convertResponseInternal(ctx, headers, object, trailers)));
        }

        try (SafeCloseable ignored = ctx.push()) {
            return responseConverter.convertResponse(ctx, headers, result, trailers);
        } catch (Exception cause) {
            return HttpResponse.ofFailure(cause);
        }
    }
Converts the specified {@code result} to an {@link HttpResponse}.
core/src/main/java/com/linecorp/armeria/internal/server/annotation/DefaultAnnotatedService.java