Class: Rubymail::Error

Inherits:
Object show all
Defined in:
lib/rubymail/rubymail_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Error

Returns a new instance of Error.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rubymail/rubymail_error.rb', line 5

def initialize(options={})
  @error =
    case options[:code]
    when 200
      # 200 status code [success code]
    when 404
      Rubymail::NotFound.new(options[:message])
    when 400
      Rubymail::BadRequest.new(options[:message])
    when 401
      Rubymail::Unauthorized.new(options[:message])
    when 402
      Rubymail::ResquestFailed.new(options[:message])
    when 500, 502, 503, 504
      Rubymail::ServerError.new(options[:message])
    else
      Rubymail::ErrorBase.new(options[:message])
    end
end

Instance Attribute Details

#errorObject

Returns the value of attribute error.



3
4
5
# File 'lib/rubymail/rubymail_error.rb', line 3

def error
  @error
end

Instance Method Details

#handleObject



25
26
27
# File 'lib/rubymail/rubymail_error.rb', line 25

def handle
  return error.handle
end