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

- (FormatError) initialize(element, value, message)

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."


273
274
275
276
277
278
# File 'lib/spiderfw/model/model.rb', line 273

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

Instance Attribute Details

- (Object) element (readonly)

Returns the value of attribute element



267
268
269
# File 'lib/spiderfw/model/model.rb', line 267

def element
  @element
end

- (Object) value (readonly)

Returns the value of attribute value



267
268
269
# File 'lib/spiderfw/model/model.rb', line 267

def value
  @value
end

Instance Method Details

- (Object) to_s



281
282
283
284
285
286
# File 'lib/spiderfw/model/model.rb', line 281

def to_s
    label = @element.label
    Spider::GetText.in_domain('spider'){
        _(@message) % label
    }
end