Exception: GandiV5::Error::GandiError
- Inherits:
-
GandiV5::Error
- Object
- RuntimeError
- GandiV5::Error
- GandiV5::Error::GandiError
- Defined in:
- lib/gandi_v5/error/gandi_error.rb
Overview
Generic error class for errors returned by Gandi.
Class Method Summary collapse
-
.from_hash(hash) ⇒ GandiV5::Error::GandiError
Generate a new GandiV5::Error::GandiError from the hash returned by Gandi.
Class Method Details
.from_hash(hash) ⇒ GandiV5::Error::GandiError
Generate a new GandiV5::Error::GandiError from the hash returned by Gandi.
10 11 12 13 14 15 16 17 18 |
# File 'lib/gandi_v5/error/gandi_error.rb', line 10 def self.from_hash(hash) hash['errors'] ||= [] new( (hash['errors'].count > 1 ? "\n" : '') + hash['errors'].map { |err| "#{err['location']}->#{err['name']}: #{err['description']}" } .join("\n") ) end |