Sha256: ffe87287d56412a2bcaa647de0f73ac8681c7d85e0309273ff91e794afdbd5c1
Contents?: true
Size: 602 Bytes
Versions: 2
Compression:
Stored size: 602 Bytes
Contents
require 'roar-rails' module HalApi::Errors class ApiError < StandardError attr_accessor :status def initialize(message = nil, status = 500) super(message || "API Error") self.status = status 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 module Representer include Roar::JSON::HAL property :status property :message end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hal_api-rails-0.2.7 | lib/hal_api/errors.rb |
hal_api-rails-0.2.6 | lib/hal_api/errors.rb |