INNER CODE UNIT · TypeScript
onFault
Hmbown/CodeWhale · crates/tui/extension-host/src/main.ts:145
function onFault(error: unknown) {
const owner = ownerStorage.getStore()
const text = error instanceof Error ? `${error.name}: ${error.message}` : String(error)
if (owner && owner.state !== 'disposed') {
rpc.notify('ext/faulted', { owner: owner.ref, error: text.slice(0, 4096) })
void host.disposeOwner(owner).catch(() => undefined)
} else {
host.log('error', `unattributed extension fault: ${text}`)
}
}
process.on('uncaughtException', onFault)
process.on('unhandledRejection', onFault)
// 5. The channel: stdin EOF means the core is gone, whatever the reason.
const decoder = new FrameDecoder()
process.stdin.on('data', (chunk: Buffer) => {
let messages: unknown[]
try {