Exception: Beekeeper::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Beekeeper::Error
- Defined in:
- lib/beekeeper/error.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
- #get_errors(options) ⇒ Object
-
#initialize(status_code, msg, options = {}) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(status_code, msg, options = {}) ⇒ Error
Returns a new instance of Error.
6 7 8 9 10 11 12 |
# File 'lib/beekeeper/error.rb', line 6 def initialize(status_code, msg, = {}) super(msg) @status_code = status_code @errors = get_errors() @data = [:data] || {} @status = @status_code end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
4 5 6 |
# File 'lib/beekeeper/error.rb', line 4 def data @data end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
4 5 6 |
# File 'lib/beekeeper/error.rb', line 4 def errors @errors end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/beekeeper/error.rb', line 4 def status @status end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
4 5 6 |
# File 'lib/beekeeper/error.rb', line 4 def status_code @status_code end |
Instance Method Details
#get_errors(options) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/beekeeper/error.rb', line 14 def get_errors() return [.delete(:error)] if [:error].present? return [:errors].errors().() if [:errors].class < ActiveRecord::Base return [:error_map] if [:error_map] return [:errors] || [{ code: class_name(), message: self. }] end |