bootstrap-vz/bootstrapvz/common/exceptions.py

27 lines
710 B
Python
Raw Normal View History

class ManifestError(Exception):
def __init__(self, message, manifest_path, json_path=None):
self.message = message
self.manifest_path = manifest_path
2013-06-23 23:37:21 +02:00
self.json_path = json_path
2013-06-26 20:14:37 +02:00
def __str__(self):
2013-06-23 23:37:21 +02:00
if self.json_path is not None:
path = '.'.join(map(str, self.json_path))
return ('{msg}\n File path: {file}\n JSON path: {jsonpath}'
.format(msg=self.message, file=self.manifest_path, jsonpath=path))
return '{file}: {msg}'.format(msg=self.message, file=self.manifest_path)
2013-06-26 20:14:37 +02:00
class TaskListError(Exception):
def __init__(self, message):
self.message = message
2013-06-26 20:14:37 +02:00
def __str__(self):
return 'Error in tasklist: {msg}'.format(msg=self.message)
2013-06-26 20:14:37 +02:00
class TaskError(Exception):
pass