Class: Hallon::Error
- Inherits:
-
Spotify::Error
- Object
- Spotify::Error
- Hallon::Error
- Defined in:
- lib/hallon/error.rb
Overview
Thrown by Hallon on libspotify errors.
Hallon::Error inherits two methods from Spotify::Error:
- Hallon::Error.explain(error) - from a Spotify error, create a descriptive string of it
- Hallon::Error.disambiguate(error) - return the tuple of [code, symbol] of a given Spotify error
Class Method Summary collapse
-
.maybe_raise(error, options = {}) ⇒ nil
Raise an Error with the given errno, unless it is
nil
,:timeout
,0
or:ok
. -
.table ⇒ Hash<Symbol, Integer>
Hash of error (Symbol) to code (Integer).
Class Method Details
.maybe_raise(error, options = {}) ⇒ nil
Raise an Hallon::Error with the given errno, unless it is nil
, :timeout
, 0
or :ok
.
30 31 32 33 34 35 36 37 38 |
# File 'lib/hallon/error.rb', line 30 def maybe_raise(error, = {}) ignore = [nil, :timeout] + Array([:ignore]) return nil if ignore.include?(error) error, symbol = disambiguate(error) return symbol if symbol == :ok raise self, explain(error) end |
.table ⇒ Hash<Symbol, Integer>
Hash of error (Symbol) to code (Integer).
16 17 18 |
# File 'lib/hallon/error.rb', line 16 def table Spotify.enum_type(:error).to_hash end |