惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog
博客园 - 叶小钗
The Cloudflare Blog
D
DataBreaches.Net
J
Java Code Geeks
G
Google Developers Blog
L
LangChain Blog
N
Netflix TechBlog - Medium
Stack Overflow Blog
Stack Overflow Blog
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
小众软件
小众软件
量子位
Apple Machine Learning Research
Apple Machine Learning Research
P
Proofpoint News Feed
博客园_首页
罗磊的独立博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog
腾讯CDC

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
refactor(process): share error normalization helper · ope...
vincentkoc · 2026-06-23 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -1,5 +1,6 @@

11

/** Timeout wrapper for node-host operations using AbortSignal cancellation. */

22

import { resolveTimerTimeoutMs } from "@openclaw/normalization-core/number-coercion";

3+

import { toErrorObject } from "../infra/errors.js";

34
45

/**

56

* AbortSignal-based timeout wrapper for node-host operations.

@@ -25,12 +26,10 @@ export async function withTimeout<T>(

2526
2627

let abortListener: (() => void) | undefined;

2728

const abortPromise: Promise<never> = abortCtrl.signal.aborted

28-

? Promise.reject(

29-

toLintErrorObject(abortCtrl.signal.reason ?? timeoutError, "Non-Error rejection"),

30-

)

29+

? Promise.reject(toErrorObject(abortCtrl.signal.reason ?? timeoutError, "Non-Error rejection"))

3130

: new Promise((_, reject) => {

3231

abortListener = () =>

33-

reject(toLintErrorObject(abortCtrl.signal.reason ?? timeoutError, "Non-Error rejection"));

32+

reject(toErrorObject(abortCtrl.signal.reason ?? timeoutError, "Non-Error rejection"));

3433

abortCtrl.signal.addEventListener("abort", abortListener, { once: true });

3534

});

3635

@@ -44,17 +43,3 @@ export async function withTimeout<T>(

4443

}

4544

}

4645

}

47-
48-

function toLintErrorObject(value: unknown, fallbackMessage: string): Error {

49-

if (value instanceof Error) {

50-

return value;

51-

}

52-

if (typeof value === "string") {

53-

return new Error(value);

54-

}

55-

const error = new Error(fallbackMessage, { cause: value });

56-

if ((typeof value === "object" && value !== null) || typeof value === "function") {

57-

Object.assign(error, value);

58-

}

59-

return error;

60-

}

Original file line numberDiff line numberDiff line change

@@ -1,6 +1,7 @@

11

// Spawn utilities configure child processes and normalize spawned process handles.

22

import type { ChildProcess, SpawnOptions } from "node:child_process";

33

import { spawn } from "node:child_process";

4+

import { toErrorObject } from "../infra/errors.js";

45
56

export type SpawnFallback = {

67

label: string;

@@ -65,7 +66,7 @@ async function spawnAndWaitForSpawn(

6566

}

6667

settled = true;

6768

cleanup();

68-

reject(toLintErrorObject(err, "Non-Error rejection"));

69+

reject(toErrorObject(err, "Non-Error rejection"));

6970

};

7071

const onSpawn = () => {

7172

finishResolve();

@@ -118,17 +119,3 @@ export async function spawnWithFallback(

118119
119120

throw lastError;

120121

}

121-
122-

function toLintErrorObject(value: unknown, fallbackMessage: string): Error {

123-

if (value instanceof Error) {

124-

return value;

125-

}

126-

if (typeof value === "string") {

127-

return new Error(value);

128-

}

129-

const error = new Error(fallbackMessage, { cause: value });

130-

if ((typeof value === "object" && value !== null) || typeof value === "function") {

131-

Object.assign(error, value);

132-

}

133-

return error;

134-

}

Original file line numberDiff line numberDiff line change

@@ -1,5 +1,6 @@

11

// Child process adapter wraps spawned child processes for the supervisor.

22

import type { ChildProcessWithoutNullStreams, SpawnOptions } from "node:child_process";

3+

import { toErrorObject } from "../../../infra/errors.js";

34

import { createWindowsOutputDecoder } from "../../../infra/windows-encoding.js";

45

import { signalProcessTree } from "../../kill-tree.js";

56

import { prepareOomScoreAdjustedSpawn } from "../../linux-oom-score.js";

@@ -354,7 +355,7 @@ export async function createChildAdapter(params: {

354355

return waitResult;

355356

}

356357

if (waitError !== undefined) {

357-

throw toLintErrorObject(waitError, "Non-Error thrown");

358+

throw toErrorObject(waitError, "Non-Error thrown");

358359

}

359360

if (!waitPromise) {

360361

waitPromise = new Promise<{ code: number | null; signal: NodeJS.Signals | null }>(

@@ -372,7 +373,7 @@ export async function createChildAdapter(params: {

372373

const error = waitError;

373374

resolveWait = null;

374375

rejectWait = null;

375-

reject(toLintErrorObject(error, "Non-Error rejection"));

376+

reject(toErrorObject(error, "Non-Error rejection"));

376377

}

377378

},

378379

);

@@ -433,17 +434,3 @@ export async function createChildAdapter(params: {

433434

dispose,

434435

};

435436

}

436-
437-

function toLintErrorObject(value: unknown, fallbackMessage: string): Error {

438-

if (value instanceof Error) {

439-

return value;

440-

}

441-

if (typeof value === "string") {

442-

return new Error(value);

443-

}

444-

const error = new Error(fallbackMessage, { cause: value });

445-

if ((typeof value === "object" && value !== null) || typeof value === "function") {

446-

Object.assign(error, value);

447-

}

448-

return error;

449-

}