GraphQL mutiny CompositeException instead of custom ErrorCode
See original GitHub issueDescribe 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
orver
: 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
orgradlew --version
): maven 3.6.3 or gradle 6.5.1
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (13 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Please close ticket when it will be available in quarkus.
@phillip-kruger fix for this: https://github.com/smallrye/smallrye-graphql/pull/653