Exception: ReactOnRails::JsonParseError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parse_error:, json:) ⇒ JsonParseError

Returns a new instance of JsonParseError.



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

#jsonObject (readonly)

Returns the value of attribute json.



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

def json
  @json
end

Instance Method Details

#raven_contextObject



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

def raven_context
  to_error_context
end

#to_error_contextObject



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_contextObject



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

def to_honeybadger_context
  to_error_context
end