From c69a53457f41534fe359f0b6036e38771151d538 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Fri, 3 Aug 2018 20:16:08 -0400 Subject: [PATCH] Catch ValidationException in graphQLHttp --- angel_graphql/lib/src/graphql_http.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/angel_graphql/lib/src/graphql_http.dart b/angel_graphql/lib/src/graphql_http.dart index c936be75..0de6a02b 100644 --- a/angel_graphql/lib/src/graphql_http.dart +++ b/angel_graphql/lib/src/graphql_http.dart @@ -48,6 +48,14 @@ RequestHandler graphQLHttp(GraphQL graphQl) { } else { throw new AngelHttpException.badRequest(); } + } on ValidationException catch (e) { + var errors = [ + 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 = [ new GraphQLExceptionError(e.message)