mirror of https://github.com/m-labs/artiq.git
Add column marker to ARTIQ exception traceback.
This commit is contained in:
parent
27d2390fed
commit
96c770190c
|
@ -2,7 +2,7 @@
|
||||||
Core ARTIQ extensions to the Python language.
|
Core ARTIQ extensions to the Python language.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import linecache
|
import linecache, re
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
|
@ -320,5 +320,6 @@ class ARTIQException(Exception):
|
||||||
function=self.function))
|
function=self.function))
|
||||||
line = linecache.getline(self.filename, self.line)
|
line = linecache.getline(self.filename, self.line)
|
||||||
lines.append(" {}".format(line.strip() if line else "<unknown>"))
|
lines.append(" {}".format(line.strip() if line else "<unknown>"))
|
||||||
|
lines.append(" {}^".format(" " * (self.column - re.search(r"^\s+", line).end())))
|
||||||
|
|
||||||
return "\n".join(lines)
|
return "\n".join(lines)
|
||||||
|
|
Loading…
Reference in New Issue