Module: Oma::Ruby::Errors
- Included in:
- Client
- Defined in:
- lib/oma-ruby/errors.rb
Overview
Errors module
Defined Under Namespace
Classes: HttpError, OpenSRSApiError
Constant Summary collapse
- HTTP_ERRORS =
{ '400' => 'BadRequestError', '404' => 'NotFoundError', '500' => 'InternalServerError' }.freeze
- API_ERRORS =
{ '0' => 'ServerError', '1' => 'InvalidCredentialsError', '2' => 'RequestedObjectDoesNotExistError', '3' => 'ObjectIsAliasError', '4' => 'RequestorLacksPermissionError', '5' => 'RequestBadlyFormattedError', '6' => 'AttributesBadlyFormattedError', '7' => 'ObjectAlreadyExistsError', '8' => 'DomainDoesNotExistError', '9' => 'RequestorDoesNotOwnObjectError', '10' => 'RequestedObjectNotEmptyError', '11' => 'CompanyDoesNotExistError', '12' => 'RoleDoesNotExistError', '13' => 'UserDoesNotExistError', '14' => 'BrandInUseError', '15' => 'DomainUsersFullError', '16' => 'DomainAliasesFullError', '17' => 'NotInError', '18' => 'WorkgroupIsDefaultError', '19' => 'MigrationJobExistsError', '20' => 'TryAgainLaterError' }.freeze
Instance Method Summary collapse
Instance Method Details
#api_error(code) ⇒ Object
51 52 53 |
# File 'lib/oma-ruby/errors.rb', line 51 def api_error(code) Oma::Ruby::Errors.const_get(API_ERRORS.fetch(code.to_s, 'OpenSRSApiError')) end |
#http_error(status) ⇒ Object
47 48 49 |
# File 'lib/oma-ruby/errors.rb', line 47 def http_error(status) Oma::Ruby::Errors.const_get(HTTP_ERRORS.fetch(status.to_s, 'HttpError')) end |