Catch ValidationException in graphQLHttp
This commit is contained in:
parent
a5a4dfe0b5
commit
c69a53457f
1 changed files with 8 additions and 0 deletions
|
@ -48,6 +48,14 @@ RequestHandler graphQLHttp(GraphQL graphQl) {
|
|||
} else {
|
||||
throw new AngelHttpException.badRequest();
|
||||
}
|
||||
} on ValidationException catch (e) {
|
||||
var errors = <GraphQLExceptionError>[
|
||||
new GraphQLExceptionError(e.message)
|
||||
];
|
||||
|
||||
errors
|
||||
.addAll(e.errors.map((ee) => new GraphQLExceptionError(ee)).toList());
|
||||
return new GraphQLException(errors).toJson();
|
||||
} on AngelHttpException catch (e) {
|
||||
var errors = <GraphQLExceptionError>[
|
||||
new GraphQLExceptionError(e.message)
|
||||
|
|
Loading…
Reference in a new issue