7 """! Base class for exceptions in this library.
10 """! @brief Constructor.
11 @param msg String to be reported to user.
12 @param excp Raised system exception if any: IOError, KeyboardInterrupt, SystemExit, IndexError, KeyError, AttributeError, TypeError, NameError, UnboundLocalError, ValueError.
13 @return An Error instance.
19 self.
frame_info = inspect.getframeinfo(inspect.currentframe().f_back)
22 """! @brief Build the string to be displayed.
23 @return A Python string.
25 from utils.io
import EOL
29 result =
" File \"" + self.frame_info.filename +
"\", line " + str(self.frame_info.lineno) +
", in " + str(self.frame_info.function) + EOL
30 result +=
" Error: " + self.
msg
34 """! @brief Define behavior to follow in case this error is caught: diplay error and exit program.
38 if self.
excp is not None:
45 """! Exception raised for errors in the input.
48 """! @brief Constructor.
49 @param msg Explanation of the error.
50 @param expr Input expression in which the error occurred.
51 @return An InputError instance.
57 self.
frame_info = inspect.getframeinfo(inspect.currentframe().f_back)
60 """! @brief Define behavior to follow in case this error is caught: display error and exit program.
64 if self.
expr is not None:
65 print " Input:", self.
expr
67 print " Input:", self.frame_info.code_context[self.frame_info.index]
73 """! Exception raised for errors in the output.
76 """! @brief Constructor.
77 @param msg Explanation of the error.
78 @param expr Output expression in which the error occurred.
79 @return An OutputError instance.
85 self.
frame_info = inspect.getframeinfo(inspect.currentframe().f_back)
88 """! @brief Define behavior to follow in case this error is caught: display error and exit program.
92 if self.
expr is not None:
93 print " Output:", self.
expr
95 print " Output:", self.frame_info.code_context[self.frame_info.index]
101 """! Base class for warnings in this library.
104 """! @brief Constructor.
105 @param msg String to be reported to user.
106 @return A Warning instance.
111 self.
frame_info = inspect.getframeinfo(inspect.currentframe().f_back)
114 """! @brief Build the string to be displayed.
115 @return A Python string.
117 from utils.io
import EOL
121 result =
" File \"" + self.frame_info.filename +
"\", line " + str(self.frame_info.lineno) +
", in " + str(self.frame_info.function) + EOL
122 result +=
" Warning: " + self.
msg
Base class for warnings in this library.
def __str__
Build the string to be displayed.
Base class for exceptions in this library.
def handle
Define behavior to follow in case this error is caught: display error and exit program.
def __str__
Build the string to be displayed.
def handle
Define behavior to follow in case this error is caught: diplay error and exit program.
Exception raised for errors in the output.