Sha256: 5b211a40b2db8d2d96b5ad11234ae93b7cd9a41a5befcdafeb5c93238afdae06

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 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: 'Invalid Token',
          status: :unprocessable_entity
        },
        'ApiPack::Errors::Auth::MissingToken' => {
          method: :error_message_body,
          title: 'Missing Token',
          status: :unprocessable_entity
        }
      }.freeze
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
api_pack-1.1.3 lib/api_pack/errors/error_map.rb
api_pack-1.1.2 lib/api_pack/errors/error_map.rb
api_pack-1.1.1 lib/api_pack/errors/error_map.rb
api_pack-1.0.1 lib/api_pack/errors/error_map.rb
api_pack-1.0.0 lib/api_pack/errors/error_map.rb