Created
May 31, 2018 21:21
-
-
Save thomsbg/2ae45d42029d894879ea8e37abfe3a9c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/controllers/graphql_controller.rb b/app/controllers/graphql_controller.rb | |
index 2e300fc0..02592ea2 100644 | |
--- a/app/controllers/graphql_controller.rb | |
+++ b/app/controllers/graphql_controller.rb | |
@@ -9,6 +9,15 @@ def execute | |
} | |
result = HermanoGraphQL.schema.execute(query, variables: variables, context: context, operation_name: operation_name) | |
render json: result | |
+ rescue StandardError => e | |
+ e = e.cause while e.cause | |
+ render status: 200, json: { | |
+ errors: [{ | |
+ name: e.class.name, | |
+ message: e.message, | |
+ time_thrown: Time.now.utc.iso8601 | |
+ }] | |
+ } | |
end | |
def heartbeat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment