Skip to content

Commit 19942b9

Browse files
sirtimidclaude
andcommitted
fix(evm-wallet-experiment): detect prettified errors in plugin, remove dead code
- Fix error detection in openclaw plugin daemon.ts: prettifySmallcaps converts #error CapData objects to strings like "[TypeError: msg]", so the old object-shape check never matched. Use string-prefix check. - Remove unused json_value() from setup-away.sh. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b18d8ac commit 19942b9

2 files changed

Lines changed: 4 additions & 14 deletions

File tree

packages/evm-wallet-experiment/openclaw-plugin/daemon.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,10 @@ async function callWallet(options: WalletCallOptions): Promise<unknown> {
146146
throw new Error(`Wallet ${method} returned non-JSON output`);
147147
}
148148

149-
// Handle error objects from vat exceptions (decoded by prettifySmallcaps)
150-
if (decoded !== null && typeof decoded === 'object' && '#error' in decoded) {
151-
const errorMsg = (decoded as Record<string, unknown>)['#error'];
152-
throw new Error(
153-
`Wallet ${method} failed: ${typeof errorMsg === 'string' ? errorMsg : JSON.stringify(errorMsg)}`,
154-
);
149+
// prettifySmallcaps converts #error objects to strings like "[TypeError: msg]".
150+
// Detect these prettified error strings and throw them as proper errors.
151+
if (typeof decoded === 'string' && decoded.startsWith('[')) {
152+
throw new Error(`Wallet ${method} failed: ${decoded}`);
155153
}
156154

157155
return decoded;

packages/evm-wallet-experiment/scripts/setup-away.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,6 @@ info() { echo -e "${CYAN}→${RESET} $*" >&2; }
162162
ok() { echo -e " ${GREEN}${RESET} $*" >&2; }
163163
fail() { echo -e " ${RED}${RESET} $*" >&2; exit 1; }
164164

165-
# Decode JSON output — for strings, output the raw value; for other types, output JSON.
166-
json_value() {
167-
node -e "
168-
const v = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8').trim());
169-
process.stdout.write(typeof v === 'string' ? v : JSON.stringify(v));
170-
"
171-
}
172-
173165
# Run a daemon exec command and log its output to stderr.
174166
# Usage: daemon_exec [--quiet] <method> <params> [--timeout <seconds>]
175167
# Pass --quiet to suppress the stderr log line (for sensitive params).

0 commit comments

Comments
 (0)