Class: Lev::Handler::Error
- Inherits:
-
Object
- Object
- Lev::Handler::Error
- Defined in:
- lib/lev/handler/error.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
need a type or source that can be :activerecord when activerecord, data should contain specific fields that can be used by generate_message in BetterErrors.
-
#data ⇒ Object
Returns the value of attribute data.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#message ⇒ Object
Returns the value of attribute message.
-
#offending_params ⇒ Object
Returns the value of attribute offending_params.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Error
constructor
A new instance of Error.
- #translate ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Error
Returns a new instance of Error.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/lev/handler/error.rb', line 13 def initialize(args={}) raise IllegalArgument if args[:code].blank? self.code = args[:code] self.data = args[:data] self.kind = args[:kind] self. = args[:message] self.offending_params = args[:offending_params] self.offending_params = [self.offending_params] if !(self.offending_params.is_a? Array) end |
Instance Attribute Details
#code ⇒ Object
need a type or source that can be :activerecord when activerecord, data should contain specific fields that can be used by generate_message in BetterErrors
7 8 9 |
# File 'lib/lev/handler/error.rb', line 7 def code @code end |
#data ⇒ Object
Returns the value of attribute data.
8 9 10 |
# File 'lib/lev/handler/error.rb', line 8 def data @data end |
#kind ⇒ Object
Returns the value of attribute kind.
9 10 11 |
# File 'lib/lev/handler/error.rb', line 9 def kind @kind end |
#message ⇒ Object
Returns the value of attribute message.
10 11 12 |
# File 'lib/lev/handler/error.rb', line 10 def end |
#offending_params ⇒ Object
Returns the value of attribute offending_params.
11 12 13 |
# File 'lib/lev/handler/error.rb', line 11 def offending_params @offending_params end |
Instance Method Details
#translate ⇒ Object
25 26 27 |
# File 'lib/lev/handler/error.rb', line 25 def translate ErrorTranslator.translate(self) end |