Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 0af22ae892f6c0b9c2a9f68951549e6f7a1733ce 1 parent 96f2437
Ahmed Eldawy authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/rasem/application.rb
8 lib/rasem/application.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.