Handle SessionError when shutting down sessions

Fixes #810
This commit is contained in:
Florian Bruhin 2020-07-16 16:26:38 +02:00
parent b20a6487f8
commit c0c0685b54
2 changed files with 11 additions and 6 deletions

View File

@ -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)
--------------------

View File

@ -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()