Sha256: 70e34ca4462a0c98a0df6a08597c3c4ed46185583ae3a3b24f39adbe8006c2cf
Contents?: true
Size: 1.47 KB
Versions: 1
Compression:
Stored size: 1.47 KB
Contents
module Routemaster module Errors class BaseError < RuntimeError attr_reader :env def initialize(env) @env = env super(message) end def errors body['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 UnauthorizedResourceAccessError < BaseError def message "Unauthorized Resource Access Error" end end class InvalidResourceError < BaseError def message "Invalid Resource Error" end end class ResourceNotFoundError < BaseError def message "Resource Not Found Error" end end class FatalResourceError < BaseError def message "Fatal Resource Error. body: #{body}, url: #{env.url}, method: #{env.method}" end end class ConflictResourceError < BaseError def message "ConflictResourceError Resource Error" end end class IncompatibleVersionError < 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 ResourceThrottlingError < BaseError def message "Resource Throttling Error" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
routemaster-drain-2.0.0 | lib/routemaster/errors.rb |