Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit 0af22ae892f6c0b9c2a9f68951549e6f7a1733ce 1 parent 96f2437
Ahmed Eldawy authored

Showing 1 changed file with 7 additions and 1 deletion. Show diff stats Hide diff stats

  1. +7 1 lib/rasem/application.rb
8 lib/rasem/application.rb
@@ -18,7 +18,13 @@ def self.run!(*argv)
18 18 svg_file = source_file + ".svg"
19 19 end
20 20 img = Rasem::SVGImage.new("100%", "100%") do
21   - eval(File.read(source_file), binding)
  21 + begin
  22 + load File.expand_path(source_file)
  23 + rescue Exception => e
  24 + # Keep the portion of stack trace that belongs to the .rasem file
  25 + backtrace = e.backtrace.grep(Regexp.new(File.expand_path(source_file)))
  26 + raise e.class, e.message, backtrace
  27 + end
22 28 end
23 29 File.open(svg_file, "w") do |f|
24 30 f << img.output

0 comments on commit 0af22ae

Please sign in to comment.
Something went wrong with that request. Please try again.