Skip to content

Commit a49f8a8

Browse files
committed
fix(nodes): preserve stale approval error context
1 parent eea994f commit a49f8a8

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎src/cli/nodes-cli/register.pairing.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ async function resolveApproveScopesForRequest(
7474
};
7575
}
7676

77-
function isUnknownNodePairRequestIdError(error: unknown): boolean {
77+
function isUnknownNodePairRequestIdError(
78+
error: unknown,
79+
): error is Error & { gatewayCode: "INVALID_REQUEST" } {
7880
const requestError = error as (Error & { gatewayCode?: unknown }) | undefined;
7981
return (
8082
requestError instanceof Error &&
@@ -163,7 +165,10 @@ export function registerNodesPairingCommands(nodes: Command) {
163165
if (!isUnknownNodePairRequestIdError(error)) {
164166
throw error;
165167
}
166-
throw new Error(buildUnknownNodePairRequestIdMessage(requestId, opts));
168+
// Reuse the gateway error so generic formatting does not append its raw cause.
169+
error.name = "Error";
170+
error.message = buildUnknownNodePairRequestIdMessage(requestId, opts);
171+
throw error;
167172
}
168173
defaultRuntime.writeJson(result);
169174
});

0 commit comments

Comments
 (0)