Exception: ToNetMeApi::Error
- Inherits:
-
StandardError
- Object
- StandardError
- ToNetMeApi::Error
- Defined in:
- lib/to_net_me_api/error.rb
Overview
An exception raised by ‘ToNetMeApi::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.
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.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/to_net_me_api/error.rb', line 16 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"] end |
Instance Attribute Details
#captcha_img ⇒ String (readonly)
Captcha image URL (only for “Captcha needed” errors).
12 13 14 |
# File 'lib/to_net_me_api/error.rb', line 12 def captcha_img @captcha_img end |
#captcha_sid ⇒ String (readonly)
Captcha identifier (only for “Captcha needed” errors).
9 10 11 |
# File 'lib/to_net_me_api/error.rb', line 9 def captcha_sid @captcha_sid end |
#error_code ⇒ Fixnum (readonly)
An error code.
6 7 8 |
# File 'lib/to_net_me_api/error.rb', line 6 def error_code @error_code end |
Instance Method Details
#message ⇒ String
A full description of the error.
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/to_net_me_api/error.rb', line 33 def = "VKontakte returned an error #{@error_code}: '#{@error_msg}'" # message << " after calling method '#{@method_name}'" # if @params.empty? # message << " without parameters." # else # message << " with parameters #{@params.inspect}." # end end |