-
-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Graphql Use new async handleException
method
#3090
Conversation
…"onException" keep "onException" for backwards compat
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
4e29063 | 384.14 ms | 447.74 ms | 63.60 ms |
d429384 | 397.33 ms | 457.69 ms | 60.36 ms |
93a76ca | 397.30 ms | 455.16 ms | 57.87 ms |
937879e | 400.98 ms | 482.84 ms | 81.86 ms |
606074f | 384.90 ms | 456.90 ms | 72.00 ms |
3d8bd2b | 379.45 ms | 450.36 ms | 70.90 ms |
2fad834 | 390.07 ms | 470.80 ms | 80.73 ms |
b172d4e | 352.92 ms | 446.50 ms | 93.58 ms |
c3f503e | 360.41 ms | 434.67 ms | 74.27 ms |
93a76ca | 378.48 ms | 451.78 ms | 73.30 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
4e29063 | 1.72 MiB | 2.29 MiB | 578.38 KiB |
d429384 | 1.72 MiB | 2.27 MiB | 558.42 KiB |
93a76ca | 1.72 MiB | 2.29 MiB | 576.75 KiB |
937879e | 1.72 MiB | 2.27 MiB | 558.42 KiB |
606074f | 1.72 MiB | 2.27 MiB | 558.30 KiB |
3d8bd2b | 1.72 MiB | 2.29 MiB | 577.53 KiB |
2fad834 | 1.72 MiB | 2.29 MiB | 577.53 KiB |
b172d4e | 1.72 MiB | 2.29 MiB | 578.09 KiB |
c3f503e | 1.72 MiB | 2.29 MiB | 577.04 KiB |
93a76ca | 1.72 MiB | 2.29 MiB | 576.75 KiB |
Previous results on branch: graphql-exception-handler
Startup times
Revision | Plain | With Sentry | Diff |
---|---|---|---|
0417432 | 422.68 ms | 477.78 ms | 55.10 ms |
b936993 | 392.46 ms | 473.14 ms | 80.69 ms |
8dd20e3 | 401.54 ms | 542.06 ms | 140.52 ms |
83cb64c | 297.31 ms | 339.06 ms | 41.75 ms |
351ac25 | 397.96 ms | 459.00 ms | 61.04 ms |
5ac1966 | 396.50 ms | 422.35 ms | 25.85 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
0417432 | 1.72 MiB | 2.27 MiB | 558.56 KiB |
b936993 | 1.72 MiB | 2.27 MiB | 554.95 KiB |
8dd20e3 | 1.72 MiB | 2.27 MiB | 558.21 KiB |
83cb64c | 1.72 MiB | 2.27 MiB | 554.95 KiB |
351ac25 | 1.72 MiB | 2.27 MiB | 558.21 KiB |
5ac1966 | 1.72 MiB | 2.27 MiB | 554.95 KiB |
handleException(handlerParameters); | ||
|
||
if (futureResult != null) { | ||
return futureResult.join(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use .get()
here combined with try/catch as well?
try { | ||
return futureResult.get(); | ||
} catch (InterruptedException | ExecutionException e) { | ||
return CompletableFuture.completedFuture((DataFetcherExceptionHandlerResult) null).join(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return CompletableFuture.completedFuture((DataFetcherExceptionHandlerResult) null).join(); | |
return null; |
handleException(handlerParameters); | ||
|
||
if (futureResult == null) { | ||
return CompletableFuture.completedFuture((DataFetcherExceptionHandlerResult) null).join(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return CompletableFuture.completedFuture((DataFetcherExceptionHandlerResult) null).join(); | |
return null; |
if (futureResult != null) { | ||
return futureResult.join(); | ||
} else { | ||
return CompletableFuture.completedFuture((DataFetcherExceptionHandlerResult) null).join(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return CompletableFuture.completedFuture((DataFetcherExceptionHandlerResult) null).join(); | |
return null; |
} | ||
|
||
@SuppressWarnings("deprecation") | ||
public @Nullable DataFetcherExceptionHandlerResult onException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adinauer this was not nullable before. Should we rather return an empty DataFetcherExceptionHandlerResult
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah I missed that, let's keep it @NotNull
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
…herExceptionHandler onException
sentry-graphql/src/main/java/io/sentry/graphql/SentryGenericDataFetcherExceptionHandler.java
Show resolved
Hide resolved
# Conflicts: # CHANGELOG.md
📜 Description
Use new async
handleException
method for compatibility with newer Graphql-Java Versions.In order to stay compatible with both older and newer verions, the
@Override
annotation of the deprecatedonException
method has been removed.onException
now calls thehandleException
implementation. The min supported GraphQL Version is 17, which introduced the new async method and thegraphQLContext
that our implementation relies on.💡 Motivation and Context
Starting with
graphql-java
v21, implementing thehandleException
method is required and the deprecated methodonException
has been removed from theDataFetcherExceptionHandler
interface.Fixes #3017
💚 How did you test it?
📝 Checklist
sendDefaultPII
is enabled.🔮 Next steps