[PR #418] [CLOSED] fix: safely handle non-Error thrown values in StoreBackend #444

Closed
opened 2026-06-05 17:23:06 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagentsjs/pull/418
Author: @lawrence3699
Created: 4/2/2026
Status: Closed

Base: mainHead: fix/safe-error-handling-in-store-backend


📝 Commits (1)

  • fd52341 fix: use type-safe error handling in store backend catch blocks

📊 Changes

1 file changed (+5 additions, -4 deletions)

View changed files

📝 libs/deepagents/src/backends/store.ts (+5 -4)

📄 Description

Summary

  • Replace catch (e: any) with catch (e: unknown) in two StoreBackend methods (readFileContent, editFileContent)
  • Guard .message access with e instanceof Error check, falling back to String(e) for non-Error thrown values
  • Prevents error responses containing undefined when a non-Error value (string, number, object) is thrown

Test plan

  • Verify existing unit tests for StoreBackend.readFileContent and editFileContent still pass
  • Confirm error message is correctly captured when a non-Error value is thrown

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/deepagentsjs/pull/418 **Author:** [@lawrence3699](https://github.com/lawrence3699) **Created:** 4/2/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/safe-error-handling-in-store-backend` --- ### 📝 Commits (1) - [`fd52341`](https://github.com/langchain-ai/deepagentsjs/commit/fd52341cd68c3fe855068cf85ce8592c28264cae) fix: use type-safe error handling in store backend catch blocks ### 📊 Changes **1 file changed** (+5 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `libs/deepagents/src/backends/store.ts` (+5 -4) </details> ### 📄 Description ## Summary - Replace `catch (e: any)` with `catch (e: unknown)` in two `StoreBackend` methods (`readFileContent`, `editFileContent`) - Guard `.message` access with `e instanceof Error` check, falling back to `String(e)` for non-Error thrown values - Prevents error responses containing `undefined` when a non-Error value (string, number, object) is thrown ## Test plan - [ ] Verify existing unit tests for `StoreBackend.readFileContent` and `editFileContent` still pass - [ ] Confirm error message is correctly captured when a non-Error value is thrown --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 17:23:06 -04:00
yindo closed this issue 2026-06-05 17:23:06 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagentsjs#444