Sha256: 0e6e4d47f66af88400fb231c9a605b0651689daa261d996ab0878289d0cfe509
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
require 'roar-rails' module HalApi::Errors class ApiError < StandardError attr_accessor :status attr_accessor :hint def initialize(message = nil, status = nil, hint = nil) super(message || "API Error") self.status = status || 500 self.hint = hint end end class Forbidden < ApiError def initialize(message = nil, hint = nil) super(message || 'Forbidden', 403, hint) end end class NotFound < ApiError def initialize(message = nil) super(message || "Resource Not Found", 404) end end class UnsupportedMediaType < ApiError def initialize(type) super("Unsupported Media Type '#{type.inspect}'", 415) end end class BadSortError < ApiError def initialize(msg, hint = nil) super(msg, 400, hint) end end class UnknownFilterError < ApiError def initialize(msg, hint = nil) super(msg, 400, hint) end end class BadFilterValueError < ApiError def initialize(msg, hint = nil) super(msg, 400, hint) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hal_api-rails-1.0.0 | lib/hal_api/errors.rb |