class Aliyun::Log::ServerError

Attributes

error_code[R]
http_code[R]
raw_message[R]
request_id[R]

Public Class Methods

new(response) click to toggle source
# File lib/aliyun/log/server_error.rb, line 10
def initialize(response)
  @http_code = response.code
  body = JSON.parse(response.body)
  @error_code = body['errorCode']
  @raw_message = body['errorMessage']
  if @error_code == 'IndexInfoInvalid'
    human_info = ' please see the rules: ' \
                 'https://help.aliyun.com/document_detail/74953.html'
    @raw_message += human_info
  end
  @request_id = response.headers['x-log-requestid']
end

Public Instance Methods

message() click to toggle source
# File lib/aliyun/log/server_error.rb, line 23
def message
  @raw_message || "UnknownError[#{http_code}]."
end
to_s() click to toggle source
# File lib/aliyun/log/server_error.rb, line 27
def to_s
  msg = @raw_message || "UnknownError[#{http_code}]."
  "error_code: #{@error_code} message: #{msg} RequestId: #{request_id}"
end