File: Errors.py

package info (click to toggle)
lysdr 1.0~git20141206+dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 832 kB
  • ctags: 1,685
  • sloc: python: 11,659; ansic: 1,335; makefile: 24
file content (37 lines) | stat: -rw-r--r-- 963 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#! /usr/bin/env python
# encoding: utf-8
# WARNING! All changes made to this file will be lost!

import traceback,os,sys
class WafError(Exception):
	def __init__(self,msg='',ex=None):
		self.msg=msg
		assert not isinstance(msg,Exception)
		self.stack=[]
		if ex:
			if not msg:
				self.msg=str(ex)
			if isinstance(ex,WafError):
				self.stack=ex.stack
			else:
				self.stack=traceback.extract_tb(sys.exc_info()[2])
		self.stack+=traceback.extract_stack()[:-1]
		self.verbose_msg=''.join(traceback.format_list(self.stack))
	def __str__(self):
		return str(self.msg)
class BuildError(WafError):
	def __init__(self,error_tasks=[]):
		self.tasks=error_tasks
		WafError.__init__(self,self.format_error())
	def format_error(self):
		lst=['Build failed']
		for tsk in self.tasks:
			txt=tsk.format_error()
			if txt:lst.append(txt)
		return'\n'.join(lst)
class ConfigurationError(WafError):
	pass
class TaskRescan(WafError):
	pass
class TaskNotReady(WafError):
	pass