Skip to content
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

Fix handling of UnknownOperationException #1760

Merged
merged 3 commits into from
Jan 9, 2024
Merged

Conversation

kilink
Copy link
Member

@kilink kilink commented Jan 2, 2024

When GraphQL.executeAsync throws UnknownOperationException, or any exception implementing GraphQLError, set the status to BAD_REQUEST / 400 in BaseDgsQueryExecutor. Fixes #1751.

@@ -204,6 +205,17 @@ internal class DefaultDgsQueryExecutorTest {
.isInstanceOf(InvalidSyntaxError::class.java)
}

@Test
fun `Invalid operation returns a GraphQL Error with type UnknownOperationException`() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also check that the status is set to BAD_REQUEST?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added an assertion for that.

When GraphQL.executeAsync throws UnknownOperationException, or any exception implementing GraphQLError,
set the status to BAD_REQUEST / 400 in BaseDgsQueryExecutor. Fixes #1751.
@kilink kilink force-pushed the unknown-operation-fix branch from 19cd3c5 to b9b3479 Compare January 8, 2024 17:34
@kilink kilink merged commit 9f561d4 into master Jan 9, 2024
3 checks passed
@kilink kilink deleted the unknown-operation-fix branch January 25, 2024 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: UnknownOperationException should return 400 instead of 500
3 participants