def check_errors(raw: false)
      return if @err_array.empty?
      command = ''
      rest = ''
      @semaphore.synchronize do
        command = @err_array.first
        rest = @err_array[1..-1].join('; ')
        @err_array.clear
      end
      message = if raw
        "#{command};#{rest}}"
      else
        "Error in previous command (\"#{command}\"): \"#{rest}\""
      end
      fail GnuplotError, message
    end
def check_errors(raw: false)
      return if @err_array.empty?
      command = ''
      rest = ''
      @semaphore.synchronize do
        command = @err_array.first
        rest = @err_array[1..-1].join('; ')
        @err_array.clear
      end
      message = if raw
        "#{command};#{rest}}"
      else
        "Error in previous command (\"#{command}\"): \"#{rest}\""
      end
      fail GnuplotError, message
    end
Check if there were errors in previous commands.
 Throws GnuplotError in case of any errors.