Skip to content

Commit

Permalink
Merge pull request #5335 from entur/map_graphql_unknown_operation_error
Browse files Browse the repository at this point in the history
Map GraphQL UnknowOperationException as bad request
  • Loading branch information
leonardehrenfried authored Aug 31, 2023
2 parents 388a94e + 1d762a6 commit 09a16e2
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import graphql.GraphQL;
import graphql.analysis.MaxQueryComplexityInstrumentation;
import graphql.execution.ExecutionStrategy;
import graphql.execution.UnknownOperationException;
import graphql.execution.instrumentation.ChainedInstrumentation;
import graphql.execution.instrumentation.Instrumentation;
import graphql.schema.CoercingParseValueException;
Expand Down Expand Up @@ -69,8 +70,8 @@ Response executeGraphQL(
return ExecutionResultMapper.okResponse(result);
} catch (OTPRequestTimeoutException te) {
return ExecutionResultMapper.timeoutResponse();
} catch (CoercingParseValueException cpve) {
return ExecutionResultMapper.badRequestResponse(cpve.getMessage());
} catch (CoercingParseValueException | UnknownOperationException e) {
return ExecutionResultMapper.badRequestResponse(e.getMessage());
} catch (Exception systemError) {
LOG.error(systemError.getMessage(), systemError);
return ExecutionResultMapper.systemErrorResponse(systemError.getMessage());
Expand Down

0 comments on commit 09a16e2

Please sign in to comment.