Skip to content

Commit

Permalink
fix: typo in exception message (#33)
Browse files Browse the repository at this point in the history
* Fix typo in exception message

* Improve exception handling in tracing
  • Loading branch information
prikha authored and rylanc committed Oct 21, 2019
1 parent 3177f50 commit 0a337f3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/apollo-federation/tracing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ module ApolloFederation
module Tracing
KEY = :ftv1
DEBUG_KEY = "#{KEY}_debug".to_sym
class NotInstalledError < StandardError
MESSAGE = 'Apollo Federation Tracing not installed. \
Add `use ApolloFederation::Tracing` to your schema.'

def message
MESSAGE
end
end

module_function

Expand All @@ -19,10 +27,7 @@ def attach_trace_to_result(result)
return result unless result.context[:tracing_enabled]

trace = result.context.namespace(KEY)
unless trace[:start_time]
raise StandardError.new, 'Apollo Federation Tracing not installed. \
Add `use ApollFederation::Tracing` to your schema.'
end
raise NotInstalledError unless trace[:start_time]

result['errors']&.each do |error|
trace[:node_map].add_error(error)
Expand Down

0 comments on commit 0a337f3

Please sign in to comment.