error.py 395 B

123456789101112
  1. class VoltLibError(Exception):
  2. def __init__(self, message, location):
  3. Exception.__init__(self, message)
  4. self.location = location
  5. def __str__(self):
  6. message = Exception.__str__(self)
  7. if self.location:
  8. path, line, column = self.location
  9. return "%s:%d:%d: %s" % (path, line, column, message)
  10. else:
  11. return message