Exception: Tinplate::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Tinplate::Error
- Defined in:
- lib/tinplate/errors.rb
Direct Known Subclasses
InaccessibleURLError, InvalidImageDataError, InvalidSearchError, NoCreditsRemainingError, NoSignatureError, ServiceUnavailableError, TooManyRequestsError, UnauthorizedError
Class Method Summary collapse
Class Method Details
.class_from_message(message) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/tinplate/errors.rb', line 14 def self.() case when /503 Service Unavailable/ then Tinplate::ServiceUnavailableError when /service is busy due to high load/ then Tinplate::ServiceUnavailableError when /Image too simple/ then Tinplate::NoSignatureError when /purchase another bundle/ then Tinplate::NoCreditsRemainingError when /Could not download/ then Tinplate::InaccessibleURLError when /Please supply an image/ then Tinplate::InvalidSearchError when /Error reading image data/ then Tinplate::InvalidImageDataError when /Too many concurrent requests/ then Tinplate::TooManyRequestsError end end |
.from_response(code, messages) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/tinplate/errors.rb', line 3 def self.from_response(code, ) return UnauthorizedError.new(.first) if code == 403 .each do || klass = () return klass.new(.join("\n")) if klass end Tinplate::Error.new(.join("\n")) end |