Sha256: 12662efc55701a7fe160c38d844d216a03244deec779401d56e112097d595344
Contents?: true
Size: 1.53 KB
Versions: 2
Compression:
Stored size: 1.53 KB
Contents
module TMS module Request # The generic TMS error class class Error < StandardError attr_reader :code def initialize(code) super("HTTP Error: #{code}") @code=code end end # Raised when a recipient list is still being constructed and a request is made to view the # recipient list for a message. class InProgress < StandardError;end end module Errors class ServerError < StandardError def initialize(response) super("TMS client encountered a server error: #{response.status} \n#{response.body}") end end class NoRelation < StandardError def initialize(rel=nil, obj=nil) message = "no link relation " message << "'#{rel}' " if rel message << 'is available' message << " for #{obj}" if obj super(message) end end class InvalidVerb < StandardError attr_reader :record def initialize(record_or_string) if record_or_string.respond_to?(:href) @record = record_or_string super("Couldn't POST #{record.class} to #{record.href}: #{record.errors.join(', ')}") else super(record_or_string) end end end class InvalidPost < InvalidVerb end class InvalidPut < InvalidVerb end class InvalidDelete < InvalidVerb end class InvalidGet < StandardError def initialize(message=nil) super(message || "Can't GET a resource after an invalid POST; either create a new object or fix errors") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tms_client-0.5.2 | lib/tms_client/errors.rb |
tms_client-0.5.1 | lib/tms_client/errors.rb |