Exception: JSON::GeneratorError

Inherits:
JSONError
  • Object
show all
Defined in:
lib/json/common.rb

Overview

This exception is raised if a generator or unparser error occurs.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from JSONError

wrap

Constructor Details

#initialize(message, invalid_object = nil) ⇒ GeneratorError

Returns a new instance of GeneratorError.



149
150
151
152
# File 'lib/json/common.rb', line 149

def initialize(message, invalid_object = nil)
  super(message)
  @invalid_object = invalid_object
end

Instance Attribute Details

#invalid_objectObject (readonly)

Returns the value of attribute invalid_object.



147
148
149
# File 'lib/json/common.rb', line 147

def invalid_object
  @invalid_object
end

Instance Method Details

#detailed_messageObject



154
155
156
157
158
159
160
# File 'lib/json/common.rb', line 154

def detailed_message(...)
  if @invalid_object.nil?
    super
  else
    "#{super}\nInvalid object: #{@invalid_object.inspect}"
  end
end