question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GraphQL mutiny CompositeException instead of custom ErrorCode

See original GitHub issue

Describe the bug When using mutiny api with smallrye-graphql its not allow you to use custom ErrorCode

Expected behavior return custom error code in response

Actual behavior always return io.smallrye.mutiny.CompositeException

      "extensions": {
        "exception": "io.smallrye.mutiny.CompositeException",
        "classification": "DataFetchingException",
        "code": "composite"
      }

Reproducer https://drive.google.com/file/d/1VEHmO6_spF8-QhPsBTUvHIJESt3KiAkF/view?usp=sharing

Sample code

@ErrorCode("custom-error")
public class CustomException extends RuntimeException {}


@GraphQLApi
public class GreetingResource {

    @Query
    public Uni<String> hello() {
        return Uni.createFrom().failure(new CustomException());
    }
}

console output:

2021-02-23 17:01:07,416 ERROR [io.sma.graphql] (ForkJoinPool.commonPool-worker-15) SRGQL012000: Data Fetching Error: io.smallrye.mutiny.CompositeException: Multiple exceptions caught:
        [Exception 0] org.acme.CustomException
        [Exception 1] io.smallrye.graphql.execution.datafetcher.DataFetcherException
        at io.smallrye.mutiny.operators.UniOnItemOrFailureMap$1.onFailure(UniOnItemOrFailureMap.java:63)
        at io.smallrye.mutiny.operators.UniSerializedSubscriber.onFailure(UniSerializedSubscriber.java:101)
        at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownFailure.subscribing(UniCreateFromKnownFailure.java:24)

Environment (please complete the following information):

  • Output of uname -a or ver: Linux andrii-PC 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • Output of java -version: openjdk version “11.0.9” 2020-10-20
  • GraalVM version (if different from Java): OpenJDK Runtime Environment GraalVM CE 20.3.0 (build 11.0.9+10-jvmci-20.3-b06)
  • Quarkus version or git rev: 1.12.0.Final
  • Build tool (ie. output of mvnw --version or gradlew --version): maven 3.6.3 or gradle 6.5.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
Andro999bcommented, Feb 25, 2021

Please close ticket when it will be available in quarkus.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error handling - Apollo GraphQL Docs
We recommend using the included Error Codes or Custom Errors for error consistency rather than directly modifying the HTTP response. Apollo Server uses ......
Read more >
chore(deps): update dependency io.quarkus:quarkus ... - GitLab
... #​15416 - Running app in OpenShift fails because of classpath set after jar; #​15271 - GraphQL mutiny CompositeException instead of custom ErrorCode...
Read more >
How To Handle Timeout Exception In Quarkus? - ADocLib
GraphQL mutiny CompositeException instead of custom ErrorCode #15271 not throw but map errors cause its general rule for reactive code.
Read more >
quarkusio/quarkus 1.13.0.Final on GitHub - NewReleases.io
#15968 - Add MP SPI dep to Smallrye GraphQL; #15966 - ClassNotFoundException ... #15271 - GraphQL mutiny CompositeException instead of custom ErrorCode ......
Read more >
Return custom errors with status code on GraphQL - Medium
After trying to return some status code on my error response using GraphQL, I found that it was not that easy as setting...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found