File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
lib/datadog/tracing/contrib/graphql Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -268,7 +268,7 @@ def add_query_error_events(span, errors)
268268 @type_key => parsed_error . type ,
269269 @stacktrace_key => parsed_error . backtrace ,
270270 @message_key => graphql_error [ 'message' ] ,
271- @locations_key => serialize_error_locations ( graphql_error [ 'locations' ] ) ,
271+ @locations_key => self . class . serialize_error_locations ( graphql_error [ 'locations' ] ) ,
272272 @path_key => graphql_error [ 'path' ] ,
273273 )
274274 )
@@ -285,7 +285,11 @@ def add_query_error_events(span, errors)
285285 # ]
286286 # is serialized as:
287287 # ["3:10", "7:8"]
288- def serialize_error_locations ( locations )
288+ def self . serialize_error_locations ( locations )
289+ # locations are only provided by the `graphql` library when the error can
290+ # be associated to a particular point in the query.
291+ return [ ] if locations . nil?
292+
289293 locations . map do |location |
290294 "#{ location [ "line" ] } :#{ location [ "column" ] } "
291295 end
You can’t perform that action at this time.
0 commit comments