forked from M-Labs/artiq
1
0
Fork 0

Add column marker to ARTIQ exception traceback.

This commit is contained in:
whitequark 2015-08-08 16:09:47 +03:00
parent 27d2390fed
commit 96c770190c
1 changed files with 2 additions and 1 deletions

View File

@ -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)