lib/leadlight/errors.rb in leadlight-0.0.2 vs lib/leadlight/errors.rb in leadlight-0.0.3
- old
+ new
@@ -1,14 +1,22 @@
+require 'forwardable'
+
module Leadlight
class Error < StandardError; end
class CredentialsRequiredError < Error; end
class HttpError < Error
+ extend Forwardable
+
attr_reader :response
- def initialize(response)
+
+ def_delegator :response, :status
+
+ def initialize(response, message=response.status.to_s)
@response = response
- super("HTTP Error #{response.status}")
+ super(message)
end
end
class ClientError < HttpError; end
class ResourceNotFound < ClientError; end
class ServerError < HttpError; end
+ class TypeError < Error; end
end