Exception: Tzu::Failure

Inherits:
StandardError
  • Object
show all
Defined in:
lib/tzu/failure.rb

Direct Known Subclasses

Invalid

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type = nil, errors = nil) ⇒ Failure

Returns a new instance of Failure.



5
6
7
8
# File 'lib/tzu/failure.rb', line 5

def initialize(type = nil, errors = nil)
  @type = type
  @raw_errors = errors
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/tzu/failure.rb', line 3

def type
  @type
end

Instance Method Details

#errorsObject



10
11
12
# File 'lib/tzu/failure.rb', line 10

def errors
  string_error? ? { errors: @raw_errors } : @raw_errors
end

#messageObject



14
15
16
# File 'lib/tzu/failure.rb', line 14

def message
  string_error? ? @raw_errors : @raw_errors.to_s
end