Class: Lev::Error

Inherits:
Object show all
Defined in:
lib/lev/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Error

Returns a new instance of Error.

Raises:

  • (ArgumentError)


13
14
15
16
17
18
19
20
21
# File 'lib/lev/error.rb', line 13

def initialize(args={})
  raise ArgumentError, "must supply a :code" if args[:code].blank?

  self.code = args[:code]
  self.data = args[:data]
  self.kind = args[:kind]
  self.message = args[:message]
  self.offending_inputs = args[:offending_inputs]
end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



5
6
7
# File 'lib/lev/error.rb', line 5

def code
  @code
end

#dataObject

Returns the value of attribute data.



6
7
8
# File 'lib/lev/error.rb', line 6

def data
  @data
end

#kindObject

Returns the value of attribute kind.



7
8
9
# File 'lib/lev/error.rb', line 7

def kind
  @kind
end

#messageObject

Returns the value of attribute message.



8
9
10
# File 'lib/lev/error.rb', line 8

def message
  @message
end

#offending_inputsObject

The inputs related to this error



11
12
13
# File 'lib/lev/error.rb', line 11

def offending_inputs
  @offending_inputs
end

Instance Method Details

#to_sObject



27
28
29
# File 'lib/lev/error.rb', line 27

def to_s
  inspect
end

#translateObject



23
24
25
# File 'lib/lev/error.rb', line 23

def translate
  ErrorTranslator.translate(self)
end