~elementary-apps/noise/trunk

« back to all changes in this revision

Viewing changes to .waf-1.6.2-ad4cc42bd7d347f7e283789e711b993f/waflib/Errors.py

  • Committer: Scott Ringwelski
  • Date: 2011-02-10 21:30:53 UTC
  • Revision ID: sgringwe@mtu.edu-20110210213053-d3c7mnexeref3cwj
sexy icons, sexy waf

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/env python
 
2
# encoding: utf-8
 
3
# WARNING! All changes made to this file will be lost!
 
4
 
 
5
import traceback,os,sys
 
6
class WafError(Exception):
 
7
        def __init__(self,msg='',ex=None):
 
8
                self.msg=msg
 
9
                assert not isinstance(msg,Exception)
 
10
                self.stack=[]
 
11
                if ex:
 
12
                        if not msg:
 
13
                                self.msg=str(ex)
 
14
                        if isinstance(ex,WafError):
 
15
                                self.stack=ex.stack
 
16
                        else:
 
17
                                self.stack=traceback.extract_tb(sys.exc_info()[2])
 
18
                self.stack+=traceback.extract_stack()[:-1]
 
19
                self.verbose_msg=''.join(traceback.format_list(self.stack))
 
20
        def __str__(self):
 
21
                return str(self.msg)
 
22
class BuildError(WafError):
 
23
        def __init__(self,error_tasks=[]):
 
24
                self.tasks=error_tasks
 
25
                WafError.__init__(self,self.format_error())
 
26
        def format_error(self):
 
27
                lst=['Build failed']
 
28
                for tsk in self.tasks:
 
29
                        txt=tsk.format_error()
 
30
                        if txt:lst.append(txt)
 
31
                return'\n'.join(lst)
 
32
class ConfigurationError(WafError):
 
33
        pass
 
34
class TaskRescan(WafError):
 
35
        pass
 
36
class TaskNotReady(WafError):
 
37
        pass