When using `str(type(exception))` this ends up to be something like `<class 'ValueError'>` for a `ValueError` exception. Get the vanilla name of the exception type via `type(exception).__name__`. Add a test to ensure that we encode this properly.