Exception: MPV::Error
- Inherits:
-
StandardError
- Object
- StandardError
- MPV::Error
- Defined in:
- lib/mpvlib/error.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(error, msg = nil) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(error, msg = nil) ⇒ Error
Returns a new instance of Error.
39 40 41 42 43 44 45 46 47 |
# File 'lib/mpvlib/error.rb', line 39 def initialize(error, msg=nil) super('MPV error: %s (%s): %s' % [ self.class.error_to_string(error), error, msg, ] ) end |
Class Method Details
.error_to_string(error) ⇒ Object
35 36 37 |
# File 'lib/mpvlib/error.rb', line 35 def self.error_to_string(error) MPV.mpv_error_string(error) end |
.raise_on_failure(msg = nil, &block) ⇒ Object
30 31 32 33 |
# File 'lib/mpvlib/error.rb', line 30 def self.raise_on_failure(msg=nil, &block) error = yield raise new(error, msg) if error && error < 0 end |