Exception: VkontakteApi::Error
- Inherits:
-
StandardError
- Object
- StandardError
- VkontakteApi::Error
- Defined in:
- lib/vkontakte_api/error.rb
Overview
An exception raised by VkontakteApi::Result
when given a response with an error.
Instance Attribute Summary collapse
-
#captcha_img ⇒ String
readonly
Captcha image URL (only for "Captcha needed" errors).
-
#captcha_sid ⇒ String
readonly
Captcha identifier (only for "Captcha needed" errors).
-
#error_code ⇒ Fixnum
readonly
An error code.
-
#redirect_uri ⇒ String
readonly
Redirect URL (only for 17 errors).
Instance Method Summary collapse
-
#initialize(data) ⇒ Error
constructor
An exception is initialized by the data from response mash.
-
#message ⇒ String
A full description of the error.
Constructor Details
#initialize(data) ⇒ Error
An exception is initialized by the data from response mash.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vkontakte_api/error.rb', line 22 def initialize(data) @error_code = data.error_code @error_msg = data.error_msg request_params = parse_params(data.request_params) @method_name = request_params.delete('method') @access_token = request_params.delete('access_token') @oauth = request_params.delete('oauth') @params = request_params @captcha_sid = data.captcha_sid @captcha_img = data.captcha_img @redirect_uri = data.redirect_uri end |
Instance Attribute Details
#captcha_img ⇒ String (readonly)
Captcha image URL (only for "Captcha needed" errors).
14 15 16 |
# File 'lib/vkontakte_api/error.rb', line 14 def captcha_img @captcha_img end |
#captcha_sid ⇒ String (readonly)
Captcha identifier (only for "Captcha needed" errors).
10 11 12 |
# File 'lib/vkontakte_api/error.rb', line 10 def captcha_sid @captcha_sid end |
#error_code ⇒ Fixnum (readonly)
An error code.
6 7 8 |
# File 'lib/vkontakte_api/error.rb', line 6 def error_code @error_code end |
#redirect_uri ⇒ String (readonly)
Redirect URL (only for 17 errors).
18 19 20 |
# File 'lib/vkontakte_api/error.rb', line 18 def redirect_uri @redirect_uri end |
Instance Method Details
#message ⇒ String
A full description of the error.
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/vkontakte_api/error.rb', line 40 def = "VKontakte returned an error #{@error_code}: '#{@error_msg}'" << " after calling method '#{@method_name}'" if @params.empty? << " without parameters." else << " with parameters #{@params.inspect}." end end |