Exception: VkLongpollBot::Exceptions::APIError
- Inherits:
-
ResponseError
- Object
- RuntimeError
- ResponseError
- VkLongpollBot::Exceptions::APIError
- Defined in:
- lib/vk_longpoll_bot/exceptions.rb
Overview
API error. Must have some code and description.
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Instance Method Summary collapse
- #code ⇒ Integer
-
#description ⇒ String
Error description from API documentation.
-
#included_message ⇒ String
Attached error description.
-
#initialize(error) ⇒ APIError
constructor
Create new instance.
Constructor Details
#initialize(error) ⇒ APIError
Create new instance.
74 75 76 77 |
# File 'lib/vk_longpoll_bot/exceptions.rb', line 74 def initialize(error) @error = error["error"] super("#{code}: #{}") end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
68 69 70 |
# File 'lib/vk_longpoll_bot/exceptions.rb', line 68 def error @error end |
Instance Method Details
#code ⇒ Integer
81 82 83 |
# File 'lib/vk_longpoll_bot/exceptions.rb', line 81 def code @error["error_code"] end |
#description ⇒ String
Returns error description from API documentation.
93 94 95 |
# File 'lib/vk_longpoll_bot/exceptions.rb', line 93 def description CODES[code] end |
#included_message ⇒ String
Returns attached error description.
87 88 89 |
# File 'lib/vk_longpoll_bot/exceptions.rb', line 87 def @error["error_msg"] end |