bootstrap-vz/bootstrapvz/common/exceptions.py

41 lines
912 B
Python
Raw Normal View History

class ManifestError(Exception):
def __init__(self, message, manifest_path, data_path=None):
2014-11-30 19:16:27 +01:00
super(ManifestError, self).__init__(message)
self.message = message
self.manifest_path = manifest_path
self.data_path = data_path
2013-06-26 20:14:37 +02:00
def __str__(self):
if self.data_path is not None:
path = '.'.join(map(str, self.data_path))
return ('{msg}\n File path: {file}\n Data path: {datapath}'
.format(msg=self.message, file=self.manifest_path, datapath=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):
2014-11-30 19:16:27 +01:00
super(TaskListError, self).__init__(message)
self.message = message
2013-06-26 20:14:37 +02:00
def __str__(self):
return 'Error in tasklist: ' + self.message
2013-06-26 20:14:37 +02:00
class TaskError(Exception):
pass
class NoMatchesError(Exception):
pass
class TooManyMatchesError(Exception):
pass
class UnitError(Exception):
pass