Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
d5de3f24 by wurstsalat at 2022-05-14T01:04:30+02:00
fix: HistoryExport: Show error if creating path fails
- - - - -
1 changed file:
- gajim/gtk/history_export.py
Changes:
=====================================
gajim/gtk/history_export.py
=====================================
@@ -117,7 +117,19 @@ def _on_export(self) -> None:
continue
file_path = make_path_from_jid(export_dir, jid)
- file_path.mkdir(parents=True, exist_ok=True)
+ try:
+ file_path.mkdir(parents=True, exist_ok=True)
+ except OSError as err:
+ error_page = cast(ErrorPage, self.get_page('error'))
+ error_page.set_text(
+ _('An error occurred while trying to create a '
+ 'file at %(path)s: %(error)s') % {
+ 'path': file_path,
+ 'error': str(err)
+ })
+ self.show_page('error', Gtk.StackTransitionType.SLIDE_LEFT)
+ return
+
with open(file_path / 'history.txt', 'w', encoding='utf-8') as
file:
file.write(f'History for {jid}\n\n')
for message in messages:
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/d5de3f244f8f5a2eea519c42c2966206e2543bdf
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/d5de3f244f8f5a2eea519c42c2966206e2543bdf
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits