Exception: ReactOnRails::JsonParseError

Inherits:
Error
  • Object
show all
Defined in:
lib/react_on_rails/json_parse_error.rb,
sig/react_on_rails/json_parse_error.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parse_error:, json:) ⇒ JsonParseError

Returns a new instance of JsonParseError.

Parameters:

  • parse_error: (StandardError)
  • json: (String)


7
8
9
10
11
12
13
14
15
16
# File 'lib/react_on_rails/json_parse_error.rb', line 7

def initialize(parse_error:, json:)
  @json = json
  @original_error = parse_error
  message = <<~MSG
    #{parse_error.message}

    #{Utils.default_troubleshooting_section}
  MSG
  super(message)
end

Instance Attribute Details

#jsonString (readonly)

Returns the value of attribute json.

Returns:

  • (String)


5
6
7
# File 'lib/react_on_rails/json_parse_error.rb', line 5

def json
  @json
end

Instance Method Details

#raven_contextHash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])


22
23
24
# File 'lib/react_on_rails/json_parse_error.rb', line 22

def raven_context
  to_error_context
end

#to_error_contextHash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])


26
27
28
29
30
31
# File 'lib/react_on_rails/json_parse_error.rb', line 26

def to_error_context
  {
    original_error: @original_error,
    json: @json
  }
end

#to_honeybadger_contextHash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])


18
19
20
# File 'lib/react_on_rails/json_parse_error.rb', line 18

def to_honeybadger_context
  to_error_context
end