|
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 | from pixie.vm.object import Type, _type_registry, WrappedException, RuntimeException, affirm, InterpreterCodeInfo, istypeinstance, \ |
3 | | - runtime_error |
| 3 | + runtime_error, add_info |
4 | 4 | from pixie.vm.code import BaseCode, PolymorphicFn, wrap_fn, as_var, defprotocol, extend, Protocol, Var, \ |
5 | 5 | list_copy, returns, intern_var |
6 | 6 | import pixie.vm.code as code |
@@ -506,12 +506,32 @@ def load_reader(rdr): |
506 | 506 | form = reader.read(rdr, False) |
507 | 507 | if form is reader.eof: |
508 | 508 | return nil |
509 | | - compiled = compiler.compile(form) |
510 | 509 |
|
511 | | - if pxic_writer is not None: |
512 | | - pxic_writer.write_object(compiled) |
| 510 | + try: |
| 511 | + compiled = compiler.compile(form) |
| 512 | + |
| 513 | + except WrappedException as ex: |
| 514 | + meta = rt.meta(form) |
| 515 | + if meta is not nil: |
| 516 | + ci = rt.interpreter_code_info(meta) |
| 517 | + add_info(ex, ci.__repr__()) |
| 518 | + add_info(ex, u"Compiling: " + rt.name(rt.str(form))) |
| 519 | + raise ex |
| 520 | + |
| 521 | + try: |
| 522 | + if pxic_writer is not None: |
| 523 | + pxic_writer.write_object(compiled) |
| 524 | + |
| 525 | + compiled.invoke([]) |
| 526 | + |
| 527 | + except WrappedException as ex: |
| 528 | + meta = rt.meta(form) |
| 529 | + if meta is not nil: |
| 530 | + ci = rt.interpreter_code_info(meta) |
| 531 | + add_info(ex, ci.__repr__()) |
| 532 | + add_info(ex, u"Running: " + rt.name(rt.str(form))) |
| 533 | + raise ex |
513 | 534 |
|
514 | | - compiled.invoke([]) |
515 | 535 |
|
516 | 536 | if not we_are_translated(): |
517 | 537 | print "done" |
|
0 commit comments