class GraphQL::Backtrace
Wrap unhandled errors with {TracedError}.
{TracedError} provides a GraphQL
backtrace with arguments and return values. The underlying error is available as {TracedError#cause}.
WARNING: {.enable} is not threadsafe because {GraphQL::Tracing.install} is not threadsafe.
@example toggling backtrace annotation
# to enable: GraphQL::Backtrace.enable # later, to disable: GraphQL::Backtrace.disable
Public Class Methods
disable()
click to toggle source
# File lib/graphql/backtrace.rb, line 32 def self.disable GraphQL::Tracing.uninstall(Backtrace::Tracer) nil end
enable()
click to toggle source
# File lib/graphql/backtrace.rb, line 26 def self.enable warn("GraphQL::Backtrace.enable is deprecated, add `use GraphQL::Backtrace` to your schema definition instead.") GraphQL::Tracing.install(Backtrace::Tracer) nil end
new(context, value: nil)
click to toggle source
# File lib/graphql/backtrace.rb, line 41 def initialize(context, value: nil) @table = Table.new(context, value: value) end
use(schema_defn)
click to toggle source
# File lib/graphql/backtrace.rb, line 37 def self.use(schema_defn) schema_defn.tracer(self::Tracer) end
Public Instance Methods
inspect()
click to toggle source
# File lib/graphql/backtrace.rb, line 45 def inspect @table.to_table end
Also aliased as: to_s
to_a()
click to toggle source
# File lib/graphql/backtrace.rb, line 51 def to_a @table.to_backtrace end