fix(look-at): catch prompt errors gracefully instead of re-throwing

session.prompt() may throw {} or JSON parse errors even when the server
successfully processes the request. Instead of crashing the tool, catch
all errors and proceed to fetch messages — if the response is available,
return it; otherwise return a clean error string.
This commit is contained in:
YeonGyu-Kim
2026-02-09 14:18:24 +09:00
parent 3d5abb950e
commit f22f14d9d1
2 changed files with 108 additions and 16 deletions
+2 -4
View File
@@ -126,12 +126,10 @@ Original error: ${createResult.error}`
},
})
} catch (promptError) {
log(`[look_at] Prompt error:`, promptError)
throw promptError
log(`[look_at] Prompt error (ignored, will still fetch messages):`, promptError)
}
log(`[look_at] Prompt sent, fetching messages...`)
log(`[look_at] Fetching messages from session ${sessionID}...`)
const messagesResult = await ctx.client.session.messages({
path: { id: sessionID },