fix: add modes export, fix event firing with modes and cloudflare

This commit is contained in:
dswbx
2025-10-28 09:18:16 +01:00
parent 2847e64b77
commit ef41b71921
10 changed files with 33 additions and 10 deletions

View File

@@ -205,7 +205,17 @@ export class EventManager<
if (listener.mode === "sync") {
syncs.push(listener);
} else {
asyncs.push(async () => await listener.handler(event, listener.event.slug));
asyncs.push(async () => {
try {
await listener.handler(event, listener.event.slug);
} catch (e) {
if (this.options?.onError) {
this.options.onError(event, e);
} else {
$console.error("Error executing async listener", listener, e);
}
}
});
}
// Remove if `once` is true, otherwise keep
return !listener.once;