bloom-lang / bud

Prototype Bud runtime (Bloom Under Development)
http://bloom-lang.net
Other
854 stars 59 forks source link

Exception reporting is annoying #251

Closed neilconway closed 12 years ago

neilconway commented 12 years ago

The stack trace we currently get out of Bud usually points at the place in stratum_fixpoint where we catch and reraise the exception, not the original site of the exception.

sriram-srinivasan commented 12 years ago

This has changed in the new runtime.

The new idiom is to only add information to the string part of the message, but to preserve the original backtrace.

e.g. in bud.eval_rules:

  rescue Exception => e
    err_msg = "** Exception while wiring rule: #{rule.src}\n ****** #{e}"
    # Create a new exception for accomodating err_msg, but reuse original backtrace
    new_e = (e.class <= Bud::Error) ? e.class.new(err_msg) : Bud::Error.new(err_msg)
    new_e.set_backtrace(e.backtrace)
    raise new_e
  end
neilconway commented 12 years ago

Thanks! I think this is resolved.