Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't crash if user calls sys.exit() (#434)
**Issue:** If user called `sys.exit()` from a WebSocket callback, the program would exit non-gracefully, printing out a big old C stack trace. **Diagnosis:** The websocket callbacks are doing some [extra zealous error checking](https://github.com/awslabs/aws-crt-python/blob/edf0ef624bd84ab6d669b9b8639e2d9a43140c95/source/websocket.c#L246-L250) when calling from C->Python. The Python code is supposed to catch and handle any exceptions resulting from the user's code. C will murder the applications if any other exceptions leak back to C, with the thinking that these must result from bugs in OUR code, so best to just die. Anyway, `sys.exit()` results in a `SystemExit` exception, which inherits from`BaseException` instead of `Exception`, so it was slipping through the Python code's `except Exception:` filter. **Description of changes:** Handle `BaseException` (not just ~Exception~) in the Python section of the callback, so that `SystemExit` doesn't leak back into C and trigger the extra zealous error checker.
- Loading branch information