Exception: Baidu::Errors::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Baidu::Errors::Error
- Defined in:
- lib/baidu/errors/error.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(msg, code = nil, response = nil) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object
Constructor Details
#initialize(msg, code = nil, response = nil) ⇒ Error
Returns a new instance of Error.
6 7 8 |
# File 'lib/baidu/errors/error.rb', line 6 def initialize(msg, code=nil, response=nil) @msg, @code, @response = msg, code, response end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
4 5 6 |
# File 'lib/baidu/errors/error.rb', line 4 def code @code end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
4 5 6 |
# File 'lib/baidu/errors/error.rb', line 4 def msg @msg end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
4 5 6 |
# File 'lib/baidu/errors/error.rb', line 4 def response @response end |
Instance Method Details
#to_s ⇒ Object
10 11 12 13 14 15 |
# File 'lib/baidu/errors/error.rb', line 10 def to_s arr = %w[Error] arr << "code: #{code}" unless code.nil? arr << "msg: #{msg}" unless msg.nil? arr.join(' ') end |