hook.py: Fixes handle_error AttributeError.