Skip to content

Commit 23efeaf

Browse files
committed
add :raw option for ErrorHandling
1 parent 9f02576 commit 23efeaf

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/gnuplotrb/fit.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def wait_for_output(term, variables)
144144
output = ''
145145
until output_ready?(output, variables)
146146
begin
147-
term.check_errors
147+
term.check_errors(raw: true)
148148
rescue GnuplotRB::GnuplotError => e
149149
output += e.message
150150
end

lib/gnuplotrb/mixins/error_handling.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module ErrorHandling
1111
##
1212
# Check if there were errors in previous commands.
1313
# Throws GnuplotError in case of any errors.
14-
def check_errors
14+
def check_errors(raw: false)
1515
return if @err_array.empty?
1616
command = ''
1717
rest = ''
@@ -20,7 +20,11 @@ def check_errors
2020
rest = @err_array[1..-1].join('; ')
2121
@err_array.clear
2222
end
23-
message = "Error in previous command (\"#{command}\"): \"#{rest}\""
23+
message = if raw
24+
"#{command};#{rest}}"
25+
else
26+
"Error in previous command (\"#{command}\"): \"#{rest}\""
27+
end
2428
fail GnuplotError, message
2529
end
2630

0 commit comments

Comments
 (0)