refactor(core): decouple run settling from terminal status transition
Resolve #running before the terminal statuschange so the settle signal can never be lost to re-entrant listeners. Hooks keep middleware semantics: a throwing hook fails the run; integrations that don't want this should suppress errors in their own hooks. Also make suppress() async-aware so rejected promises (e.g. showMask) are actually caught.
This commit is contained in:
@@ -133,9 +133,9 @@ export function assert(condition: unknown, message?: string, silent?: boolean):
|
||||
/**
|
||||
* Suppress errors from a function.
|
||||
*/
|
||||
export function suppress<T>(fn: () => T): T | undefined {
|
||||
export async function suppress<T>(fn: () => T | Promise<T>): Promise<Awaited<T> | undefined> {
|
||||
try {
|
||||
return fn()
|
||||
return await fn()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
return undefined
|
||||
|
||||
Reference in New Issue
Block a user