Represents all etcd custom errors
# File lib/etcd/exceptions.rb, line 17 def self.from_http_response(response) opts = JSON.parse(response.body) unless ERROR_CODE_MAPPING.key?(opts['errorCode']) fail "Unknown error code: #{opts['errorCode']}" end ERROR_CODE_MAPPING[opts['errorCode']].new(opts) end
# File lib/etcd/exceptions.rb, line 10 def initialize(opts = {}) super(opts['message']) @cause = opts['cause'] @index = opts['index'] @error_code = opts['errorCode'] end
# File lib/etcd/exceptions.rb, line 25 def inspect "<#{self.class}: index:#{index}, code:#{error_code}, cause:'#{cause}'>" end