Skip to content

Commit 0a337f3

Browse files
prikharylanc
authored andcommitted
fix: typo in exception message (#33)
* Fix typo in exception message * Improve exception handling in tracing
1 parent 3177f50 commit 0a337f3

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/apollo-federation/tracing.rb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ module ApolloFederation
44
module Tracing
55
KEY = :ftv1
66
DEBUG_KEY = "#{KEY}_debug".to_sym
7+
class NotInstalledError < StandardError
8+
MESSAGE = 'Apollo Federation Tracing not installed. \
9+
Add `use ApolloFederation::Tracing` to your schema.'
10+
11+
def message
12+
MESSAGE
13+
end
14+
end
715

816
module_function
917

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

2129
trace = result.context.namespace(KEY)
22-
unless trace[:start_time]
23-
raise StandardError.new, 'Apollo Federation Tracing not installed. \
24-
Add `use ApollFederation::Tracing` to your schema.'
25-
end
30+
raise NotInstalledError unless trace[:start_time]
2631

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

0 commit comments

Comments
 (0)