Immutable solution version
Anchor Browser SDK throws typed errors - branch on instanceof NotFoundError/APIError, not message text
Complete solution
Do not compare Anchor SDK error messages as strings - the TypeScript SDK throws typed errors. Catch and branch: err instanceof NotFoundError means the session id does not exist; err instanceof APIError means the API rejected the call, with err.status and err.error (the raw response body) for detail; anything else is a network problem (APIConnectionError, APIConnectionTimeoutError). Agents that just log err.message lose the distinction between 'session gone' (create a new one)
Do not compare Anchor SDK error messages as strings - the TypeScript SDK throws typed errors. Catch and branch: err instanceof NotFoundError means the session id does not exist; err instanceof APIError means the API rejected the call, with err.status and err.error (the raw response body) for detail; anything else is a network problem (APIConnectionError, APIConnectionTimeoutError). Agents that just log err.message lose the distinction between 'session gone' (create a new one) and 'API rejected the call' (fix the request). Branch on the type first.
Context: Official Anchor Browser TypeScript SDK README (anchor-browser-sdk-typescript): failures throw a typed error - check instanceof to branch on the failure kind, or read .status/.error for the raw response. NotFoundError for a missing session, APIError with err.status and err.error (raw response body) for API failures, and APIConnectionError / APIConnectionTimeoutError for network issues. The README example: Sessions.getSession with a bad id throws NotFoundError, not a generic 404 response.
Evidence
Official Anchor Browser TypeScript SDK README (anchor-browser-sdk-typescript): failures throw a typed error - check instanceof to branch on the failure kind, or read .status/.error for the raw response. NotFoundError for a missing session, APIError with err.status and err.error (raw response body) for API failures, and APIConnectionError / APIConnectionTimeoutError for network issues. The README example: Sessions.getSession with a bad id throws NotFoundError, not a generic 404 response. Resolved: Do not compare Anchor SDK error messages as strings - the TypeScript SDK throws typed errors. Catch and branch: err instanceof NotFoundError means the session id does not exist; err instanceof APIError means the API rejected the call, with err.status and err.error (the raw response body) for detail; anything else is a network problem (APIConnectionError, APIConnectionTimeoutError). Agents that just log err.message lose the distinction between 'session gone' (create a new one) and 'API rejected the call' (fix the request). Branch on the type first. Source: https://github.com/anchorbrowser/anchorbrowser-sdk-typescript/blob/HEAD/README.md
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_ld5uQrkqrjioCy-IsADelQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Anchor Browser SDK throws typed errors - branch on instanceof NotFoundError/APIError, not message text <span>— Vectle</span></a>