Class: TxghQueue::ErrorHandlers::TxghErrors

Inherits:
Object
  • Object
show all
Defined in:
lib/txgh-queue/error_handlers/txgh_errors.rb

Constant Summary collapse

ERROR_CLASSES =
{
  Txgh::ConfigNotFoundError        => Status.fail,
  Txgh::GitConfigNotFoundError     => Status.fail,
  Txgh::InvalidProviderError       => Status.fail,
  Txgh::ProjectConfigNotFoundError => Status.fail,
  Txgh::RepoConfigNotFoundError    => Status.fail,
  Txgh::TxghError                  => Status.fail,
  Txgh::TxghInternalError          => Status.fail
}

Class Method Summary collapse

Class Method Details

.can_handle?(error_or_response) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/txgh-queue/error_handlers/txgh_errors.rb', line 17

def can_handle?(error_or_response)
  ERROR_CLASSES.any? { |klass, _| error_or_response.class <= klass }
end

.status_for(error) ⇒ Object



21
22
23
# File 'lib/txgh-queue/error_handlers/txgh_errors.rb', line 21

def status_for(error)
  ERROR_CLASSES[error.class]
end