Handle errors in :dump-page.
This commit is contained in:
parent
e405492667
commit
b37dac7bfa
@ -1240,8 +1240,13 @@ class CommandDispatcher:
|
|||||||
data = mainframe.toPlainText()
|
data = mainframe.toPlainText()
|
||||||
else:
|
else:
|
||||||
data = mainframe.toHtml()
|
data = mainframe.toHtml()
|
||||||
|
|
||||||
|
try:
|
||||||
with open(dest, 'w', encoding='utf-8') as f:
|
with open(dest, 'w', encoding='utf-8') as f:
|
||||||
f.write(data)
|
f.write(data)
|
||||||
|
except OSError as e:
|
||||||
|
raise cmdexc.CommandError('Could not write page: {}'.format(e))
|
||||||
|
else:
|
||||||
message.info(self._win_id, "Dumped page to {}.".format(dest))
|
message.info(self._win_id, "Dumped page to {}.".format(dest))
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', name='help',
|
@cmdutils.register(instance='command-dispatcher', name='help',
|
||||||
|
Loading…
Reference in New Issue
Block a user