MCPcopy
hub / github.com/Gallopsled/pwntools / PwnlibException

Class PwnlibException

pwnlib/exception.py:6–26  ·  view source on GitHub ↗

Exception thrown by :func:`pwnlib.log.error`. Pwnlib functions that encounters unrecoverable errors should call the :func:`pwnlib.log.error` function instead of throwing this exception directly.

Source from the content-addressed store, hash-verified

4
5
6class PwnlibException(Exception):
7 '''Exception thrown by :func:`pwnlib.log.error`.
8
9 Pwnlib functions that encounters unrecoverable errors should call the
10 :func:`pwnlib.log.error` function instead of throwing this exception directly.'''
11 def __init__(self, msg, reason = None, exit_code = None):
12 '''bar'''
13 Exception.__init__(self, msg)
14 self.reason = reason
15 self.exit_code = exit_code
16 self.message = msg
17
18 def __repr__(self):
19 s = 'PwnlibException: %s' % self.message
20 if self.reason:
21 s += '\nReason:\n'
22 s += ''.join(traceback.format_exception(*self.reason))
23 elif sys.exc_info()[0] not in [None, KeyboardInterrupt]:
24 s += '\n'
25 s += ''.join(traceback.format_exc())
26 return s

Callers 1

errorMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected