1
2 """Standardized Error Messages"""
3
4 import traceback
5 import sys
6
8 try:
9 f = traceback.extract_stack(limit=up+2)
10 if f:
11 return f[0]
12 except:
13 if __debug__:
14 traceback.print_exc()
15 pass
16 return ('', 0, '', None)
17
19 """Common function for errors and Warnings"""
20 info=getLine(up=2)
21 print >>sys.stderr, "PyFoam",standard.upper(),"on line",info[1],"of file",info[0],":",
22 for t in text:
23 print >>sys.stderr,t,
24 print >>sys.stderr
25
27 """Prints a warning message with the occuring line number
28 @param text: The error message"""
29 __common("Warning",*text)
30
32 """Prints an error message with the occuring line number and aborts
33 @param text: The error message"""
34 __common("Fatal Error",*text)
35 sys.exit(-1)
36
38 """Prints a debug message with the occuring line number
39 @param text: The error message"""
40 __common("Debug",*text)
41
43 """The simplest exception for PyFoam"""
44
47
49 return "Problem in PyFoam: '"+self.descr+"'"
50