Comments (10)
We could probably find a way to expose that so you can customize the errors. We currently have a bean GraphQLConfiguration - but it is not that useful for something like this.
from elide.
from elide.
Just followed up and seen that the code that's causing this to happen is this one:
It's inside com.yahoo.elide.graphql.QueryRunner
. It's throwing a new exception of type WebApplicationException
which is causing it to lose all error objects in the original CustomErrorException
.
from elide.
I see the first issue with Jersey, but not the second when I throw a CustomErrorException from a lifecycle hook. My custom error hits the error mapper and it includes all the error objects. Are you sure your lifecycle hook is triggering the exception (and not some other error)?
HTTP/1.1 200 OK
Date: Sun, 05 Mar 2023 01:27:18 GMT
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Content-Length: 47
{
"errors": [
{
"message": "Custom Error Message"
}
]
}
from elide.
Ok - I see the second issue now too for PREFLUSH and PRESECURITY hooks.
from elide.
So it looks like graphql-java swallows the exception:
The exception is there, but there is no method on GraphQLError
to get at it. In short, we can fix the first problem (the jersey issue), but I don't know of a solution to fix the 2nd without a corresponding patch to graphql-java.
from elide.
Yes, correct. I'm throwing my exception in a PRESECURITY hook.
For the 'ErrorObjects getting lost' problem, I suppose we can resolve this by defining a custom exception that implements GraphQLError
. We can then add our extra errors to the extensions
field (which is a map) in the Graphql error
from elide.
Again, using Elide, there's no way of overriding Graphql's DataFetcherExceptionHandler
so that you can throw your own custom exceptions as you'd like. This is because we have to do something like this:
@Bean
public GraphQL graphQL(GraphQLSchema schema) {
return GraphQL.newGraphQL(schema)
.queryExecutionStrategy(new AsyncExecutionStrategy(new CustomDataFetcherExceptionHandler()))
.mutationExecutionStrategy(new AsyncSerialExecutionStrategy(new CustomDataFetcherExceptionHandler()))
.build();
}
which gives the error No beans of GraphQLSchema type found
from elide.
When will fix this get to Elide version 7? I'm still using version 7.0.0-pr2
(due to Spring Boot 3/Java 17 support). Version 7.0.0-pr2
is the only one that's available on Maven Central
from elide.
Thanks. Good stuff
from elide.
Related Issues (20)
- Is it possible to filter by json fields? HOT 9
- Cannot traverse more than one level up a graph HOT 9
- Overriding `DataFetcherExceptionHandler` has no effect HOT 5
- JSON Patch Operation Read Permission Issue HOT 2
- Does Elide support "speed" (average over date) measure? HOT 1
- "no transaction is in progress" with spring boot and 7.0.0 pr5 HOT 2
- OpenAPIBuilder removes paths for relationships that are 3 levels deep. (7.0.0pr5)
- Generated OAS incorrectly sets objects as nodes
- elide-spring-boot-starter:7.0.0-pr5 doesn't work with spring boot 3.1.1 HOT 5
- CVE-2023-34620 - HJson vulnerability. HOT 2
- Attempting to deploy standalone Elide WAR app results in "java.lang.IllegalStateException: No Jetty ContextHandler, Jakarta WebSocket SCI unavailable" HOT 2
- Is two-phase binding mandatory? HOT 3
- Elide 7.x Release schedule HOT 8
- Aggregation data store with json fields
- Hibernate L2 cache
- 7.0.0-pr6 error: Unknown collection HOT 1
- Cannot use Map with 7.0.0-pr6 HOT 2
- JsonApi.patch NullPointerException when missing headers
- RSQL =ini= cannot handle kotlin enums HOT 1
- Lifecycle hook ordering is not deterministic in v7 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elide.