Skip to content

Commit

Permalink
Correctly print a stack trace for an excepion inside a rasem file
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmed Eldawy committed Jul 9, 2011
1 parent 96f2437 commit 0af22ae
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/rasem/application.rb
Expand Up @@ -18,7 +18,13 @@ def self.run!(*argv)
svg_file = source_file + ".svg" svg_file = source_file + ".svg"
end end
img = Rasem::SVGImage.new("100%", "100%") do 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 end
File.open(svg_file, "w") do |f| File.open(svg_file, "w") do |f|
f << img.output f << img.output
Expand Down

0 comments on commit 0af22ae

Please sign in to comment.