Sha256: 6f9aa4e752bff63e6306a0871abc0f00a50058efce4b4c387125fa53f44068c9

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

module ApiPack
  module Errors
    module ErrorMap
      ERROR_MAP = {
        'ActiveRecord::RecordNotFound' => {
          method: :error_message_body,
          title: 'Not Found',
          status: :not_found
        },
        'ActionController::ParameterMissing' => {
          method: :parameter_missing,
          title: 'Parameter Missing',
          status: :unprocessable_entity
        },
        'ActiveRecord::RecordInvalid' => {
          method: :record_invalid,
          title: 'Validations Failed',
          status: :unprocessable_entity
        },
        'ApiPack::Errors::Auth::AuthenticationError' => {
          method: :error_message_body,
          title: 'Invalid Credentials',
          status: :unauthorized
        },
        'ApiPack::Errors::Auth::InvalidToken' => {
          method: :error_message_body,
          title: 'Access Denied - Invalid Token',
          status: :forbidden
        },
        'ApiPack::Errors::Auth::MissingToken' => {
          method: :error_message_body,
          title: 'Missing Token',
          status: :unprocessable_entity
        }
      }.freeze
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
api_pack-1.3.1 lib/api_pack/errors/error_map.rb
api_pack-1.2.1 lib/api_pack/errors/error_map.rb
api_pack-1.1.4 lib/api_pack/errors/error_map.rb