Sha256: a4ed885b03522f9df50709027b25f27f35baa0fceae8eb92ddab8403cd015fca
Contents?: true
Size: 1.86 KB
Versions: 3
Compression:
Stored size: 1.86 KB
Contents
module Routemaster module Errors class BaseError < RuntimeError attr_reader :env def initialize(env) @env = env super(message) end def errors body.fetch('errors', {}) end def message raise NotImplementedError end def body @body ||= deserialized_body end private def deserialized_body @env.body.empty? ? {} : JSON.parse(@env.body) end end class UnauthorizedResourceAccess < BaseError def message "Unauthorized Resource Access Error" end end class InvalidResource < BaseError def message "Invalid Resource Error" end end class ResourceNotFound < BaseError def message "Resource Not Found Error" end end class ResourceGone < BaseError def message "Resource Gone: #{env.url}" end end class FatalResource < BaseError def message "Fatal Resource Error. body: #{env.body}, url: #{env.url}, method: #{env.method}" end end class ConflictResource < BaseError def message "ConflictResourceError Resource Error" end end class IncompatibleVersion < BaseError def message headers = env.request_headers.select { |k, _| k != 'Authorization' } "Incompatible Version Error. headers: #{headers}, url: #{env.url}, method: #{env.method}" end end class ResourceThrottling < BaseError def message "Resource Throttling Error" end end class MethodNotAllowed < BaseError def message "Method Not Allowed" end end class BadGateway < BaseError def message "Bad Gateway" end end class ServiceNotAvailable < BaseError def message "Service Not Available" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
routemaster-drain-3.7.1 | lib/routemaster/errors.rb |
routemaster-drain-3.7.0 | lib/routemaster/errors.rb |
routemaster-drain-3.6.8 | lib/routemaster/errors.rb |