Exception: ZSS::Error
- Inherits:
-
StandardError
- Object
- StandardError
- ZSS::Error
- Defined in:
- lib/zss/error.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#developer_message ⇒ Object
Returns the value of attribute developer_message.
-
#user_message ⇒ Object
readonly
Returns the value of attribute user_message.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code = 500, developer_message = nil, payload: nil) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(code = 500, developer_message = nil, payload: nil) ⇒ Error
Returns a new instance of Error.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/zss/error.rb', line 9 def initialize(code = 500, = nil, payload: nil) if payload fail "Invalid error code: #{code}" if code.blank? else data = self.class.get_errors[code.to_s] payload = data.body if data end fail "Invalid error with code: #{code}" unless payload @code = code.to_i @developer_message = || payload.developerMessage @user_message = payload.userMessage super @developer_message set_backtrace caller end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'lib/zss/error.rb', line 6 def code @code end |
#developer_message ⇒ Object
Returns the value of attribute developer_message.
7 8 9 |
# File 'lib/zss/error.rb', line 7 def @developer_message end |
#user_message ⇒ Object (readonly)
Returns the value of attribute user_message.
6 7 8 |
# File 'lib/zss/error.rb', line 6 def @user_message end |