bin/lscript in liquidscript-0.6.1 vs bin/lscript in liquidscript-0.6.2

- old
+ new

@@ -6,12 +6,18 @@ puts "Usage: #{File.basename($0)} infile [outfile]" exit 1 end infile = ARGV.shift -outfile = ARGV.shift || infile.gsub(/\.ls\Z/, ".js") +outfile = ARGV.shift || infile.gsub(/\.liq\Z/, ".js") File.open(infile, "r") do |f| - out = Liquidscript::Template.new(f.read).render - File.open(outfile, "w") { |o| o.write out } + begin + out = Liquidscript::Template.new(f.read).render + File.open(outfile, "w") { |o| o.write out } + rescue StandardError => e + $stderr.puts "ERROR: #{e.class}: #{e.message}" + $stderr.puts e.backtrace[0..5].map { |s| "\t#{s.gsub(/^.*?\/lib\/liquidscript\//, "")}" }.join("\n") + end + end