Sha256: 2519a4c65e5c2113f57081c154541a818b055c2339cb69e59209c518d5097c84
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
module Hatio module Exception class HatioError < StandardError; end class InsufficientParameter < HatioError; end class MisConfigured < HatioError; end class ResourceNotFound < HatioError; end class ServerError < HatioError; end class InvalidRequest < HatioError; end class ValidationWarning < HatioError; end @status_code_map = { 'ActiveRecord::RecordNotUnique' => :internal_server_error, 'ActiveRecord::RecordNotFound' => :not_found, 'ActiveRecord::StatementInvalid' => :internal_server_error, 'Hatio::Exception::ResourceNotFound' => :not_found, 'Hatio::Exception::InsufficientParameter' => :bad_request, 'Hatio::Exception::MisConfigured' => :internal_server_error, 'Hatio::Exception::ServerError' => :internal_server_error, 'Hatio::Exception::InvalidRequest' => :bad_request, 'Hatio::Exception::ValidationWarning' => :bad_request } def self.get_status_code e @status_code_map[e.class.name] || :internal_server_error end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hatio-core-0.0.6 | lib/hatio-core/exception/exceptions.rb |