Friendly error messages

This commit is contained in:
kojix2 2022-05-25 16:24:13 +09:00
parent 3b1c662e70
commit c090a11377

View File

@ -81,9 +81,15 @@ module YouPlot
# normal mode # normal mode
else else
# Sometimes the input file does not end with a newline code. # Sometimes the input file does not end with a newline code.
while (input = Kernel.gets(nil)) begin
main(input) begin
input = Kernel.gets(nil)
rescue Errno::ENOENT => e
warn e.message
next
end end
main(input)
end until input
end end
end end
@ -155,6 +161,10 @@ module YouPlot
warn 'Please try to set the correct character encoding with --encoding option.' warn 'Please try to set the correct character encoding with --encoding option.'
warn e.backtrace.grep(/youplot/).first warn e.backtrace.grep(/youplot/).first
exit 1 exit 1
rescue ArgumentError => e
warn 'Failed to parse the text. '
warn e.backtrace.grep(/youplot/).first
exit 1
end end
data data