Skip to content

Commit a3a9087

Browse files
committed
fix: fix error handling
1 parent edf943b commit a3a9087

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/index.vue

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,21 @@ export default {
6262
}
6363
6464
this.$el.removeAttribute('data-processed');
65-
mermaid.parseError = error => this.$emit('parse-error', error);
6665
67-
await mermaid.run({
68-
nodes: [this.$el],
69-
postRenderCallback: () => this.$emit('rendered'),
70-
});
66+
mermaid.parseError = error => {
67+
console.log('reacting to parse-error');
68+
console.log(error);
69+
this.$emit('parse-error', error);
70+
};
71+
72+
try {
73+
await mermaid.run({
74+
nodes: [this.$el],
75+
postRenderCallback: () => this.$emit('rendered'),
76+
});
77+
} catch {
78+
// Mermaid will throw the error although the parseError function is set
79+
}
7180
},
7281
immediate: true,
7382
},

0 commit comments

Comments
 (0)