From 2dc1e964e4e2e45a042a4fccd7d05546228e790e Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Tue, 3 Jan 2012 16:56:51 +0100 Subject: [PATCH] Improved handling of template errors --- stoptime.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stoptime.rb b/stoptime.rb index 0597fef..6eef681 100644 --- a/stoptime.rb +++ b/stoptime.rb @@ -984,6 +984,9 @@ module StopTime::Controllers erb = ERB.new(File.read(template)) File.open(tex_file, "w") { |f| f.write(erb.result(binding)) } end + rescue Exception => err + tex_file.delete + raise err end # Generates a PDF document for the invoice with the given _number_