3
# Thomas Nagy, 2010 (ita)
6
Exceptions used in the Waf code
11
class WafError(Exception):
12
"""Base class for all Waf errors"""
13
def __init__(self, msg='', ex=None):
15
:param msg: error message
17
:param ex: exception causing this error (optional)
21
assert not isinstance(msg, Exception)
27
if isinstance(ex, WafError):
30
self.stack = traceback.extract_tb(sys.exc_info()[2])
31
self.stack += traceback.extract_stack()[:-1]
32
self.verbose_msg = ''.join(traceback.format_list(self.stack))
37
class BuildError(WafError):
39
Errors raised during the build and install phases
41
def __init__(self, error_tasks=[]):
43
:param error_tasks: tasks that could not complete normally
44
:type error_tasks: list of task objects
46
self.tasks = error_tasks
47
WafError.__init__(self, self.format_error())
49
def format_error(self):
50
"""format the error messages from the tasks that failed"""
51
lst = ['Build failed']
52
for tsk in self.tasks:
53
txt = tsk.format_error()
54
if txt: lst.append(txt)
57
class ConfigurationError(WafError):
59
Configuration exception raised in particular by :py:meth:`waflib.Context.Context.fatal`
63
class TaskRescan(WafError):
64
"""task-specific exception type, trigger a signature recomputation"""
67
class TaskNotReady(WafError):
68
"""task-specific exception type, raised when the task signature cannot be computed"""