Exception: Suitcase::Hotel::EANException

Inherits:
Exception
  • Object
show all
Defined in:
lib/suitcase/hotel/ean_exception.rb

Overview

Public: An Exception to be raised from all EAN API-related errors.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, type = nil) ⇒ EANException

Internal: Create a new EAN exception.

message - The String error message returned by the API. type - The Symbol type of the error.



21
22
23
24
# File 'lib/suitcase/hotel/ean_exception.rb', line 21

def initialize(message, type = nil)
  @type = type
  super(message)
end

Instance Attribute Details

#recoveryObject

Public: Getter for the recovery information.



9
10
11
# File 'lib/suitcase/hotel/ean_exception.rb', line 9

def recovery
  @recovery
end

#typeObject

Public: Getter for the error type..



15
16
17
# File 'lib/suitcase/hotel/ean_exception.rb', line 15

def type
  @type
end

Instance Method Details

#recoverable?Boolean

Public: Check if the error is recoverable. If it is, recovery information

is in the attribute recovery.

Returns a Boolean based on whether the error is recoverable.

Returns:

  • (Boolean)


30
31
32
# File 'lib/suitcase/hotel/ean_exception.rb', line 30

def recoverable?
  @recovery.is_a?(Hash)
end