@@ -14,6 +14,7 @@ import {
|
14 | 14 | type OwnedSessionTranscriptCacheSnapshot, |
15 | 15 | withOwnedSessionTranscriptWrites, |
16 | 16 | } from "../../../config/sessions/transcript-write-context.js"; |
| 17 | +import { toErrorObject } from "../../../infra/errors.js"; |
17 | 18 | import { resolveGlobalSingleton } from "../../../shared/global-singleton.js"; |
18 | 19 | import { isTranscriptOnlyOpenClawAssistantMessage } from "../../../shared/transcript-only-openclaw-assistant.js"; |
19 | 20 | import { isSessionWriteLockAcquireError } from "../../session-write-lock-error.js"; |
@@ -891,7 +892,7 @@ function waitForSessionFileOwnerRelease(params: {
|
891 | 892 | }): Promise<void> { |
892 | 893 | if (params.signal?.aborted) { |
893 | 894 | return Promise.reject( |
894 | | -toLintErrorObject(abortOwnerWaitReason(params.signal), "Non-Error rejection"), |
| 895 | +toErrorObject(abortOwnerWaitReason(params.signal), "Non-Error rejection"), |
895 | 896 | ); |
896 | 897 | } |
897 | 898 | return new Promise<void>((resolve, reject) => { |
@@ -915,21 +916,15 @@ function waitForSessionFileOwnerRelease(params: {
|
915 | 916 | }; |
916 | 917 | waiter.reject = (error) => { |
917 | 918 | cleanup(); |
918 | | -reject(toLintErrorObject(error, "Non-Error rejection")); |
| 919 | +reject(toErrorObject(error, "Non-Error rejection")); |
919 | 920 | }; |
920 | 921 | const timeoutMs = resolveSessionFileOwnerWaitTimeoutMs(params.timeoutMs); |
921 | 922 | if (timeoutMs !== undefined) { |
922 | | -waiter.timer = setTimeout( |
923 | | -() => { |
924 | | -waiter.reject( |
925 | | -new EmbeddedAttemptSessionFileOwnerTimeoutError( |
926 | | -params.sessionFile, |
927 | | -timeoutMs, |
928 | | -), |
929 | | -); |
930 | | -}, |
931 | | -timeoutMs, |
932 | | -); |
| 923 | +waiter.timer = setTimeout(() => { |
| 924 | +waiter.reject( |
| 925 | +new EmbeddedAttemptSessionFileOwnerTimeoutError(params.sessionFile, timeoutMs), |
| 926 | +); |
| 927 | +}, timeoutMs); |
933 | 928 | waiter.timer.unref?.(); |
934 | 929 | } |
935 | 930 | if (params.signal) { |
@@ -2084,17 +2079,3 @@ export function installPromptSubmissionLockRelease(params: {
|
2084 | 2079 | wrappedStreamFn["__openclawSessionLockPromptReleaseInstalled"] = true; |
2085 | 2080 | agent.streamFn = wrappedStreamFn; |
2086 | 2081 | } |
2087 | | - |
2088 | | -function toLintErrorObject(value: unknown, fallbackMessage: string): Error { |
2089 | | -if (value instanceof Error) { |
2090 | | -return value; |
2091 | | -} |
2092 | | -if (typeof value === "string") { |
2093 | | -return new Error(value); |
2094 | | -} |
2095 | | -const error = new Error(fallbackMessage, { cause: value }); |
2096 | | -if ((typeof value === "object" && value !== null) || typeof value === "function") { |
2097 | | -Object.assign(error, value); |
2098 | | -} |
2099 | | -return error; |
2100 | | -} |