refactor(core): suppress mask/highlight errors instead of failing the run

Visual feedback failures (showMask, hideMask, cleanUpHighlights) are
non-critical; log them instead of aborting the task or masking the
original error during teardown.
This commit is contained in:
Simon
2026-06-11 16:26:42 +08:00
parent c2d6a864f8
commit 8f9a637bdb
2 changed files with 17 additions and 5 deletions

View File

@@ -129,3 +129,15 @@ export function assert(condition: unknown, message?: string, silent?: boolean):
throw new Error(errorMessage)
}
}
/**
* Suppress errors from a function.
*/
export function suppress<T>(fn: () => T): T | undefined {
try {
return fn()
} catch (error) {
console.error(error)
return undefined
}
}