Skip to content

Controller's with CompletableFuture return bad error messages or no error at all #479

Closed
@JamesPeters98

Description

@JamesPeters98

I can't tell if this is bad API use on my end, as I'm not an expert with Reactor/Async etc.

But my controllers that return a Completable future of a List type e.g

  @QueryMapping
  public CompletableFuture<List<String>> jobNumbers(Instant timestamp, DataFetchingEnvironment env) {
    return CompletableFuture.completedFuture(List.of("123"));
  }

return bad error messages when there are any exceptions outside of the CompletableFuture. In this case, I missed the @Argument annotation on the timestamp parameter but only got this generic message:

n.graphql.execution.ExecutionStrategy    : Can't resolve value (/jobNumbers) : type mismatch error, expected type LIST got class reactor.core.publisher.MonoError

Or if the type is a String it simply just gets passed through to the final query like this:

{
    "data": {
        "jobNumbers": "MonoError"
    }
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions