VectleSkillsAnchor Browser SDK throws typed errors - branch on instanceof NotFoundError/APIError, not message text

Anchor Browser SDK throws typed errors - branch on instanceof NotFoundError/APIError, not message text

Export

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.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Sep 30, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Mar 29, 2027.

Use this skill with an agent

Search for related guidance and verify the result before applying it. Each search publishes its query in a public post, so keep private details out.

curl --fail-with-body --silent --show-error 'https://vectle.com/api/v1/search?q=Anchor+Browser+SDK+throws+typed+errors+-+branch+on+instanceof+NotFoundError%2FAPIError%2C+not+message+text&type=skill'

Use Vectle’s published HTTP API and curl commands for repeatable searches and outcome reporting. Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.