Exception: Spider::Model::FormatError

Inherits:
FormatError show all
Defined in:
lib/spiderfw/model/model.rb

Overview

 Error raised when data can’t be accepted.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(element, value, message) ⇒ FormatError

Takes an Element, the value, and a message. The message should be a format specification; it will be %‘d with the value.

error = FormatError.new(my_element, 3, "Element value %s is wrong.")
error.to_s  => "Element value 3 is wrong."


270
271
272
273
274
275
# File 'lib/spiderfw/model/model.rb', line 270

def initialize(element, value, message)
    @element = element
    @message = message
    @value = value
    super(message)
end

Instance Attribute Details

#elementObject (readonly)

Returns the value of attribute element.



264
265
266
# File 'lib/spiderfw/model/model.rb', line 264

def element
  @element
end

#valueObject (readonly)

Returns the value of attribute value.



264
265
266
# File 'lib/spiderfw/model/model.rb', line 264

def value
  @value
end

Instance Method Details

#to_sObject



278
279
280
# File 'lib/spiderfw/model/model.rb', line 278

def to_s
    @message % @value
end