3 # Thomas Nagy, 2010-2018 (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)
20 Exception.__init
__(self
)
22 assert not isinstance(msg
, Exception)
28 if isinstance(ex
, WafError
):
31 self
.stack
= traceback
.extract_tb(sys
.exc_info()[2])
32 self
.stack
+= traceback
.extract_stack()[:-1]
33 self
.verbose_msg
= ''.join(traceback
.format_list(self
.stack
))
38 class BuildError(WafError
):
39 """Error raised during the build and install phases"""
40 def __init__(self
, error_tasks
=[]):
42 :param error_tasks: tasks that could not complete normally
43 :type error_tasks: list of task objects
45 self
.tasks
= error_tasks
46 WafError
.__init
__(self
, self
.format_error())
48 def format_error(self
):
49 """Formats the error messages from the tasks that failed"""
50 lst
= ['Build failed']
51 for tsk
in self
.tasks
:
52 txt
= tsk
.format_error()
57 class ConfigurationError(WafError
):
58 """Configuration exception raised in particular by :py:meth:`waflib.Context.Context.fatal`"""
61 class TaskRescan(WafError
):
62 """Task-specific exception type signalling required signature recalculations"""
65 class TaskNotReady(WafError
):
66 """Task-specific exception type signalling that task signatures cannot be computed"""