Exception: Backblaze::RequestError

Inherits:
Error
  • Object
show all
Defined in:
lib/backblaze/errors.rb

Overview

Note:

this could be abstract, but just keeps things simple.

Basic needs for error messages.

Direct Known Subclasses

AuthError, BucketError, FileError

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ RequestError

Creates the Error


15
16
17
# File 'lib/backblaze/errors.rb', line 15

def initialize(response)
  @response = response
end

Instance Method Details

#[](key) ⇒ Object

Shortcut to access the response keys


51
52
53
# File 'lib/backblaze/errors.rb', line 51

def [](key)
  @response[key]
end

#codeString

The Backblaze B2 error code


29
30
31
# File 'lib/backblaze/errors.rb', line 29

def code
  self['code']
end

#messageString

The Backblaze B2 error message which is a human explanation


43
44
45
# File 'lib/backblaze/errors.rb', line 43

def message
  self['message']
end

#responseHTTParty::Response

The response from the server


22
23
24
# File 'lib/backblaze/errors.rb', line 22

def response
  @response
end

#statusInteger

The Backblaze B2 request status


36
37
38
# File 'lib/backblaze/errors.rb', line 36

def status
  self['status']
end