forked from M-Labs/artiq
1
0
Fork 0

CoreException: store at 'py_exn.artiq_core_exception'

... and fix a few imports
This commit is contained in:
Robert Jördens 2016-01-25 16:48:13 -07:00
parent 0d7dc7b144
commit f4c7f02127
4 changed files with 13 additions and 10 deletions

View File

@ -457,8 +457,8 @@ class CommGeneric:
self._write_header(_H2DMsgType.RPC_EXCEPTION) self._write_header(_H2DMsgType.RPC_EXCEPTION)
if hasattr(exn, 'core_exception'): if hasattr(exn, 'artiq_core_exception'):
exn = exn.core_exception exn = exn.artiq_core_exception
self._write_string(exn.name) self._write_string(exn.name)
self._write_string(exn.message) self._write_string(exn.message)
for index in range(3): for index in range(3):
@ -504,15 +504,15 @@ class CommGeneric:
traceback = list(reversed(symbolizer(backtrace))) + \ traceback = list(reversed(symbolizer(backtrace))) + \
[(filename, line, column, function, None)] [(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: if core_exn.id == 0:
python_exn_type = getattr(exceptions, core_exception.name.split('.')[-1]) python_exn_type = getattr(exceptions, core_exn.name.split('.')[-1])
else: 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 = python_exn_type(message.format(*params))
python_exn.core_exception = core_exception python_exn.artiq_core_exception = core_exn
raise python_exn raise python_exn
def serve(self, object_map, symbolizer): def serve(self, object_map, symbolizer):

View File

@ -1,4 +1,8 @@
import builtins import builtins
import linecache
import re
import os
from artiq.coredevice.runtime import source_loader from artiq.coredevice.runtime import source_loader

View File

@ -132,8 +132,8 @@ def run(with_file=False):
except CompileError as error: except CompileError as error:
return return
except Exception as exn: except Exception as exn:
if hasattr(exn, 'core_exception'): if hasattr(exn, 'artiq_core_exception'):
print(exn.core_exception, file=sys.stderr) print(exn.artiq_core_exception, file=sys.stderr)
raise exn raise exn
finally: finally:
device_mgr.close_devices() device_mgr.close_devices()

View File

@ -2,7 +2,6 @@
Core ARTIQ extensions to the Python language. Core ARTIQ extensions to the Python language.
""" """
import os, linecache, re
from collections import namedtuple from collections import namedtuple
from functools import wraps from functools import wraps