Exception: K2ConnectionError
- Defined in:
- lib/k2-connect-ruby/k2_errors.rb
Overview
For errors concerning the Status code returned from Kopo Kopo
Instance Attribute Summary
Attributes inherited from K2Errors
Instance Method Summary collapse
-
#initialize(error) ⇒ K2ConnectionError
constructor
A new instance of K2ConnectionError.
- #message ⇒ Object
Constructor Details
#initialize(error) ⇒ K2ConnectionError
Returns a new instance of K2ConnectionError.
11 12 13 |
# File 'lib/k2-connect-ruby/k2_errors.rb', line 11 def initialize(error) @error = error end |
Instance Method Details
#message ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/k2-connect-ruby/k2_errors.rb', line 15 def case @error when 400.to_s STDERR.puts "Bad Request.\n\tYour request is Invalid" when 401.to_s STDERR.puts "Unauthorized.\n Your API key is wrong" when 403.to_s STDERR.puts "Forbidden.\n The resource requested cannot be accessed" when 404.to_s STDERR.puts "Not Found.\n\tThe specified resource could not be found" when 405.to_s STDERR.puts "Method Not Allowed.\n You tried to access a resource with an invalid method" when 406.to_s STDERR.puts "Not Acceptable.\n You requested a format that isn't valid json" when 410.to_s STDERR.puts "Gone.\n The resource requested has been moved" when 429.to_s STDERR.puts "Too Many Requests.\n Request threshold has been exceeded" when 500.to_s STDERR.puts "Internal Server Error.\n We had a problem with our server. Try again later" when 503.to_s STDERR.puts "Service Unavailable.\n We're temporarily offline for maintenance. Please try again later" else STDERR.puts 'Undefined Kopo Kopo Server Response.' end end |