Exception: COS::ServerError
- Defined in:
- lib/cos/exception.rb
Overview
服务端返回异常 Code: -166, Message: 索引不存在, HttpCode: 400 Code: -173, Message: 目录非空, HttpCode: 400 Code: -180, Message: 非法路径, HttpCode: 400 Code: -288, Message: process打包失败, HttpCode: 400 Code: -4018, Message: 相同文件已上传过, HttpCode: 400 Code: -5997, Message: 后端网络错误, HttpCode: 400 Code: -5999, Message: 参数错误, HttpCode: 400
Instance Attribute Summary collapse
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#http_code ⇒ Object
readonly
Returns the value of attribute http_code.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(response) ⇒ ServerError
constructor
A new instance of ServerError.
- #to_s ⇒ Object
Constructor Details
#initialize(response) ⇒ ServerError
Returns a new instance of ServerError.
22 23 24 25 26 27 28 29 |
# File 'lib/cos/exception.rb', line 22 def initialize(response) @response = response resp_obj = JSON.parse(response.body) @error_code = resp_obj['code'] @message = resp_obj['message'] @http_code = response.code end |
Instance Attribute Details
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
20 21 22 |
# File 'lib/cos/exception.rb', line 20 def error_code @error_code end |
#http_code ⇒ Object (readonly)
Returns the value of attribute http_code.
20 21 22 |
# File 'lib/cos/exception.rb', line 20 def http_code @http_code end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
20 21 22 |
# File 'lib/cos/exception.rb', line 20 def @message end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
20 21 22 |
# File 'lib/cos/exception.rb', line 20 def response @response end |
Instance Method Details
#to_s ⇒ Object
35 36 37 |
# File 'lib/cos/exception.rb', line 35 def to_s "ServerError Code: #{error_code}, Message: #{}, HttpCode: #{http_code}" end |