mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
listener exception doesn't stop execution
This commit is contained in:
parent
f071d3f651
commit
12d82e3b33
@ -1,3 +1,5 @@
|
|||||||
|
const log = require('./log');
|
||||||
|
|
||||||
const NOTE_TITLE_CHANGED = "NOTE_TITLE_CHANGED";
|
const NOTE_TITLE_CHANGED = "NOTE_TITLE_CHANGED";
|
||||||
const ENTER_PROTECTED_SESSION = "ENTER_PROTECTED_SESSION";
|
const ENTER_PROTECTED_SESSION = "ENTER_PROTECTED_SESSION";
|
||||||
const ENTITY_CHANGED = "ENTITY_CHANGED";
|
const ENTITY_CHANGED = "ENTITY_CHANGED";
|
||||||
@ -14,8 +16,14 @@ async function emit(eventType, data) {
|
|||||||
|
|
||||||
if (listeners) {
|
if (listeners) {
|
||||||
for (const listener of listeners) {
|
for (const listener of listeners) {
|
||||||
|
try {
|
||||||
await listener(data);
|
await listener(data);
|
||||||
}
|
}
|
||||||
|
catch (e) {
|
||||||
|
log.error("Listener threw error: " + e.stack);
|
||||||
|
// we won't stop execution because of listener
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user