Skip to content

Commit

Permalink
Show error if there's an exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjko committed Jul 4, 2024
1 parent f47792e commit c296afc
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/lib/MarkupView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,18 @@
async function save() {
if (edit) {
saving = true;
const error = await edit(revisedText);
if (error) {
addError(errors, 'Unable to save markup.', error);
} else {
markup = revisedText;
try {
const error = await edit(revisedText);
if (error) {
addError(errors, 'Unable to save markup.', error);
} else {
markup = revisedText;
editing = false;
}
} catch (err) {
editing = false;
addError(errors, '' + err);
saving = false;
}
saving = false;
} else markup = revisedText;
Expand Down

0 comments on commit c296afc

Please sign in to comment.