Class: Fauna::Failure

Inherits:
Object
  • Object
show all
Defined in:
lib/fauna/errors.rb

Overview

Part of ErrorData. For more information, see the docs.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, description, field) ⇒ Failure

:nodoc:



193
194
195
196
197
# File 'lib/fauna/errors.rb', line 193

def initialize(code, description, field) # :nodoc:
  @code = code
  @description = description
  @field = field
end

Instance Attribute Details

#codeObject (readonly)

Failure code.



179
180
181
# File 'lib/fauna/errors.rb', line 179

def code
  @code
end

#descriptionObject (readonly)

Failure description.



181
182
183
# File 'lib/fauna/errors.rb', line 181

def description
  @description
end

#fieldObject (readonly)

Field of the failure in the instance.



183
184
185
# File 'lib/fauna/errors.rb', line 183

def field
  @field
end

Class Method Details

.from_hash(hash) ⇒ Object

:nodoc:



185
186
187
188
189
190
191
# File 'lib/fauna/errors.rb', line 185

def self.from_hash(hash) # :nodoc:
  Failure.new(
    ErrorHelpers.get_or_throw(hash, :code),
    ErrorHelpers.get_or_throw(hash, :description),
    ErrorHelpers.map_position(hash[:field]),
  )
end

Instance Method Details

#inspectObject

:nodoc:



199
200
201
# File 'lib/fauna/errors.rb', line 199

def inspect # :nodoc:
  "Failure(#{code.inspect}, #{description.inspect}, #{field.inspect})"
end