diff --git a/app/graphql/lupo_schema.rb b/app/graphql/lupo_schema.rb index c5e1cf0c7..7389c72a5 100644 --- a/app/graphql/lupo_schema.rb +++ b/app/graphql/lupo_schema.rb @@ -31,13 +31,15 @@ class LupoSchema < GraphQL::Schema GraphQL::ExecutionError.new(exception.record.errors.full_messages.join("\n")) end + rescue_from CSL::ParseError do |exception| + Raven.capture_exception(exception) + message = exception.message + GraphQL::ExecutionError.new(message) + 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 - # end end diff --git a/app/graphql/types/doi_item.rb b/app/graphql/types/doi_item.rb index 4e26460f9..59a58537a 100644 --- a/app/graphql/types/doi_item.rb +++ b/app/graphql/types/doi_item.rb @@ -339,8 +339,6 @@ def formatted_citation(style: nil, locale: nil) url = "https://doi.org/#{object.doi}" end bibliography.first.gsub(url, doi_link(url)) - rescue CSL::ParseError => e - "Error: #{e.message}" end def references(**args)