AI agent instructions
AI agent instructions
await inside try/catch.
Configuration errors
NotteClient throws anError for a missing API key or an unsupported API URL. HTTPS is required for remote servers; HTTP is allowed on loopback for local development.
API and execution errors
High-level methods generally wrap failed API responses in ordinary JavaScriptError objects. The Node SDK does not provide Python’s NotteAPIError exception hierarchy or a consistent status_code property.
Treat caught values as unknown: check error instanceof Error before reading error.message. Do not depend on parsing error messages to identify HTTP status codes.
Session cleanup
Use Session.use for managed sessions. It starts the session before your callback and stops it when the callback finishes, including when it throws. Catch errors around the awaiteduse() call so failures reach your error handler.