mirror of
https://github.com/zadam/trilium.git
synced 2025-11-17 10:40:41 +01:00
listener exception doesn't stop execution
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user