| Conditions | 2 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | #!/usr/bin/env python3 |
||
| 9 | def handle_exception(exc, msg="SOMETHING WENT WRONG", xit=SystemExit): |
||
| 10 | """ |
||
| 11 | Print msg, then text of exception exc, then raise exception xit. |
||
| 12 | |||
| 13 | :param exc: Exception to handle. |
||
| 14 | :type exc: Exception |
||
| 15 | |||
| 16 | :param msg: Message to raise, "SOMETHING WENT WRONG" by default. |
||
| 17 | :type msg: str |
||
| 18 | |||
| 19 | :param xit: Exception to raise upon exit, SystemExit by default. |
||
| 20 | :type xit: Exception |
||
| 21 | """ |
||
| 22 | print(msg) |
||
| 23 | print(str(exc)) |
||
| 24 | if xit != DummyException: |
||
| 25 | raise xit |
||
| 26 | |||
| 33 |