Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/ruby-mws/api/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ def self.parse(hash, name, params)
def self.handle_error_response(error)
msg = "#{error.code}: #{error.message}"
msg << " -- #{error.detail}" unless error.detail.nil?
raise ErrorResponse, msg
if MWS.const_defined? error.code
raise "MWS::#{error.code}".constantize, msg
else
raise ErrorResponse, msg
end
end

end

end
end
14 changes: 11 additions & 3 deletions lib/ruby-mws/exceptions.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module MWS

class MWSException < StandardError
end

Expand All @@ -9,9 +8,18 @@ class MissingConnectionOptions < MWSException
class NoNextToken < MWSException
end

class BadResponseError < MWSException
end

class ErrorResponse < MWSException
end

class BadResponseError < MWSException
class AccessDenied < ErrorResponse
end

class RequestThrottled < ErrorResponse
end

class InvalidParameterValue < ErrorResponse
end
end
end