Exception: Helium::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Helium::Error
- Defined in:
- lib/helium/error.rb
Overview
Custom error class for rescuing from Helium API errors
Direct Known Subclasses
Class Method Summary collapse
-
.from_response(response) ⇒ Helium::Error
Returns the appropriate Helium::Error subclass based on status and response message.
Class Method Details
.from_response(response) ⇒ Helium::Error
Returns the appropriate Helium::Error subclass based on status and response message
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/helium/error.rb', line 10 def self.from_response(response) status = response.code = JSON.parse(response.body)["errors"].first["detail"] klass = case status when 401 then Helium::InvalidApiKey else self end klass.new() end |