Permalink
Browse files

Correctly print a stack trace for an excepion inside a rasem file

  • Loading branch information...
1 parent 96f2437 commit 0af22ae892f6c0b9c2a9f68951549e6f7a1733ce Ahmed Eldawy committed Jul 9, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/rasem/application.rb
View
8 lib/rasem/application.rb
@@ -18,7 +18,13 @@ def self.run!(*argv)
svg_file = source_file + ".svg"
end
img = Rasem::SVGImage.new("100%", "100%") do
- eval(File.read(source_file), binding)
+ begin
+ load File.expand_path(source_file)
+ rescue Exception => e
+ # Keep the portion of stack trace that belongs to the .rasem file
+ backtrace = e.backtrace.grep(Regexp.new(File.expand_path(source_file)))
+ raise e.class, e.message, backtrace
+ end
end
File.open(svg_file, "w") do |f|
f << img.output

0 comments on commit 0af22ae

Please sign in to comment.