From e9a223ba4c06779dca59ae066117d0d9843f1dc7 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Wed, 15 May 2019 06:55:14 +0200 Subject: [PATCH] Better error message in production. #268 --- app/graphql/lupo_schema.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/graphql/lupo_schema.rb b/app/graphql/lupo_schema.rb index cc20f34ef..137d867db 100644 --- a/app/graphql/lupo_schema.rb +++ b/app/graphql/lupo_schema.rb @@ -17,9 +17,11 @@ class LupoSchema < GraphQL::Schema GraphQL::ExecutionError.new(exception.record.errors.full_messages.join("\n")) end - # rescue_from StandardError do |exception| - # GraphQL::ExecutionError.new("Please try to execute the query for this field later") - # end + rescue_from StandardError do |exception| + Raven.capture_exception(exception) + message = Rails.env.production? ? "We are sorry, but an error has occured. This problem has been logged and support has been notified. Please try again later. If the error persists please contact support." : exception.message + GraphQL::ExecutionError.new(message) + end # rescue_from CustomError do |exception, object, arguments, context| # nil