forked from M-Labs/artiq
CoreException: store at 'py_exn.artiq_core_exception'
... and fix a few imports
This commit is contained in:
parent
0d7dc7b144
commit
f4c7f02127
|
@ -457,8 +457,8 @@ class CommGeneric:
|
|||
|
||||
self._write_header(_H2DMsgType.RPC_EXCEPTION)
|
||||
|
||||
if hasattr(exn, 'core_exception'):
|
||||
exn = exn.core_exception
|
||||
if hasattr(exn, 'artiq_core_exception'):
|
||||
exn = exn.artiq_core_exception
|
||||
self._write_string(exn.name)
|
||||
self._write_string(exn.message)
|
||||
for index in range(3):
|
||||
|
@ -504,15 +504,15 @@ class CommGeneric:
|
|||
|
||||
traceback = list(reversed(symbolizer(backtrace))) + \
|
||||
[(filename, line, column, function, None)]
|
||||
core_exception = exceptions.CoreException(name, message, params, traceback)
|
||||
core_exn = exceptions.CoreException(name, message, params, traceback)
|
||||
|
||||
if core_exception.id == 0:
|
||||
python_exn_type = getattr(exceptions, core_exception.name.split('.')[-1])
|
||||
if core_exn.id == 0:
|
||||
python_exn_type = getattr(exceptions, core_exn.name.split('.')[-1])
|
||||
else:
|
||||
python_exn_type = object_map.retrieve(core_exception.id)
|
||||
python_exn_type = object_map.retrieve(core_exn.id)
|
||||
|
||||
python_exn = python_exn_type(message.format(*params))
|
||||
python_exn.core_exception = core_exception
|
||||
python_exn.artiq_core_exception = core_exn
|
||||
raise python_exn
|
||||
|
||||
def serve(self, object_map, symbolizer):
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
import builtins
|
||||
import linecache
|
||||
import re
|
||||
import os
|
||||
|
||||
from artiq.coredevice.runtime import source_loader
|
||||
|
||||
|
||||
|
|
|
@ -132,8 +132,8 @@ def run(with_file=False):
|
|||
except CompileError as error:
|
||||
return
|
||||
except Exception as exn:
|
||||
if hasattr(exn, 'core_exception'):
|
||||
print(exn.core_exception, file=sys.stderr)
|
||||
if hasattr(exn, 'artiq_core_exception'):
|
||||
print(exn.artiq_core_exception, file=sys.stderr)
|
||||
raise exn
|
||||
finally:
|
||||
device_mgr.close_devices()
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
Core ARTIQ extensions to the Python language.
|
||||
"""
|
||||
|
||||
import os, linecache, re
|
||||
from collections import namedtuple
|
||||
from functools import wraps
|
||||
|
||||
|
|
Loading…
Reference in New Issue