diff options
author | Florian Bruhin <me@the-compiler.org> | 2020-07-16 16:26:38 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2020-07-16 16:26:38 +0200 |
commit | c0c0685b54b2322845c9915fa4e342e223e2a070 (patch) | |
tree | 0cc3258f09f1af77477ddadd2564b9a075e5014f | |
parent | b20a6487f886ebd9141834ddcde5351c99b9b35a (diff) | |
download | qutebrowser-c0c0685b54b2322845c9915fa4e342e223e2a070.tar.gz qutebrowser-c0c0685b54b2322845c9915fa4e342e223e2a070.zip |
Handle SessionError when shutting down sessions
Fixes #810
-rw-r--r-- | doc/changelog.asciidoc | 2 | ||||
-rw-r--r-- | qutebrowser/misc/sessions.py | 15 |
2 files changed, 11 insertions, 6 deletions
diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index c5e1ba2c1..94efa43d8 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -56,6 +56,8 @@ Fixed mode and get hints assigned correctly. - When checkmarks, radio buttons and some other elements are styled via the Bootstrap CSS framework, they now get hints correctly. +- When the session file isn't writable when qutebrowser is quit, an error is + now logged instead of crashing. v1.13.1 (unreleased) -------------------- diff --git a/qutebrowser/misc/sessions.py b/qutebrowser/misc/sessions.py index 37fd0a4ba..de221b1aa 100644 --- a/qutebrowser/misc/sessions.py +++ b/qutebrowser/misc/sessions.py @@ -85,12 +85,15 @@ def shutdown(session: typing.Optional[ArgType], last_window: bool) -> None: if session_manager is None: return - if session is not None: - session_manager.save(session, last_window=last_window, - load_next_time=True) - elif config.val.auto_save.session: - session_manager.save(default, last_window=last_window, - load_next_time=True) + try: + if session is not None: + session_manager.save(session, last_window=last_window, + load_next_time=True) + elif config.val.auto_save.session: + session_manager.save(default, last_window=last_window, + load_next_time=True) + except SessionError as e: + log.sessions.error("Failed to save session: {}".format(e)) session_manager.delete_autosave() |