Base class for all exceptions raised by this module.
| 4 | import sys |
| 5 | |
| 6 | class ExceptionPexpect(Exception): |
| 7 | '''Base class for all exceptions raised by this module. |
| 8 | ''' |
| 9 | |
| 10 | def __init__(self, value): |
| 11 | super(ExceptionPexpect, self).__init__(value) |
| 12 | self.value = value |
| 13 | |
| 14 | def __str__(self): |
| 15 | return str(self.value) |
| 16 | |
| 17 | def get_trace(self): |
| 18 | '''This returns an abbreviated stack trace with lines that only concern |
| 19 | the caller. In other words, the stack trace inside the Pexpect module |
| 20 | is not included. ''' |
| 21 | |
| 22 | tblist = traceback.extract_tb(sys.exc_info()[2]) |
| 23 | tblist = [item for item in tblist if ('pexpect/__init__' not in item[0]) |
| 24 | and ('pexpect/expect' not in item[0])] |
| 25 | tblist = traceback.format_list(tblist) |
| 26 | return ''.join(tblist) |
| 27 | |
| 28 | |
| 29 | class EOF(ExceptionPexpect): |
no outgoing calls
searching dependent graphs…