Improved error messages

This commit is contained in:
kojix2 2023-01-05 13:54:47 +09:00
parent a6c054f596
commit 0e2f8014fd

View File

@ -81,7 +81,7 @@ module YouPlot
elsif param_members.include?(k) elsif param_members.include?(k)
@params[k] ||= v @params[k] ||= v
else else
raise Error, "Unknown option/param: #{k}" raise Error, "Unknown option/param in config file: #{k}"
end end
end end
end end
@ -373,7 +373,7 @@ module YouPlot
show_config_info show_config_info
else else
error_message = "uplot: unrecognized command '#{command}'" error_message = "YouPlot: unrecognized command '#{command}'"
raise Error, error_message unless YouPlot.run_as_executable? raise Error, error_message unless YouPlot.run_as_executable?
warn error_message warn error_message
@ -386,7 +386,7 @@ module YouPlot
begin begin
create_main_parser.order!(argv) create_main_parser.order!(argv)
rescue OptionParser::ParseError => e rescue OptionParser::ParseError => e
warn "uplot: #{e.message}" warn "YouPlot: #{e.message}"
exit 1 if YouPlot.run_as_executable? exit 1 if YouPlot.run_as_executable?
end end
@ -395,11 +395,16 @@ module YouPlot
begin begin
create_sub_parser&.parse!(argv) create_sub_parser&.parse!(argv)
rescue OptionParser::ParseError => e rescue OptionParser::ParseError => e
warn "uplot: #{e.message}" warn "YouPlot: #{e.message}"
exit 1 if YouPlot.run_as_executable? exit 1 if YouPlot.run_as_executable?
end end
begin
apply_config_file apply_config_file
rescue StandardError => e
warn "YouPlot: #{e.message}"
exit 1 if YouPlot.run_as_executable?
end
end end
end end
end end