mirror of
https://github.com/zadam/trilium.git
synced 2025-06-05 17:38:47 +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 ENTER_PROTECTED_SESSION = "ENTER_PROTECTED_SESSION";
|
||||
const ENTITY_CHANGED = "ENTITY_CHANGED";
|
||||
@ -14,7 +16,13 @@ async function emit(eventType, data) {
|
||||
|
||||
if (listeners) {
|
||||
for (const listener of listeners) {
|
||||
await listener(data);
|
||||
try {
|
||||
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