Module: GnuplotRB::ErrorHandling
- Included in:
- Terminal
- Defined in:
- lib/gnuplotrb/mixins/error_handling.rb
Overview
Mixin for classes that need to run subprocess and handle errors from its stderr.
Instance Method Summary collapse
-
#check_errors ⇒ Object
Overview Check if there were errors in previous commands.
Instance Method Details
#check_errors ⇒ Object
Overview
Check if there were errors in previous commands. Throws GnuplotError in case of any errors.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gnuplotrb/mixins/error_handling.rb', line 15 def check_errors return if @err_array.empty? command = '' rest = '' @semaphore.synchronize do command = @err_array.first rest = @err_array[1..-1].join('; ') @err_array.clear end = "Error in previous command (\"#{command}\"): \"#{rest}\"" fail GnuplotError, end |