Class: Calendav::ErrorHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/calendav/error_handler.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ErrorHandler

Returns a new instance of ErrorHandler.



11
12
13
# File 'lib/calendav/error_handler.rb', line 11

def initialize(response)
  @response = response
end

Class Method Details

.callObject



7
8
9
# File 'lib/calendav/error_handler.rb', line 7

def self.call(...)
  new(...).call
end

Instance Method Details

#callObject

Raises:



15
16
17
18
19
20
# File 'lib/calendav/error_handler.rb', line 15

def call
  raise PreconditionError, response if status.code == 412
  raise RedirectError, response if status.redirect?

  raise RequestError, response
end