Errors
The SDKs raise four error types, so you can branch on the type rather than parse a message. All
four extend AuraError, so one catch covers everything.
| Type | Means | Carries |
|---|---|---|
AuraApiError |
The API rejected the call | status, detail |
AuraResponseError |
The server answered, but with something the SDK could not read | status when known |
AuraTurnCancelledError |
The turn stopped before finishing | the partial content, the conversation id |
AuraTurnTimeoutError |
Your wait elapsed — the turn is still running | the conversation id, the elapsed wait |
A rejected request
Section titled “A rejected request”Any non-2xx response. status is the HTTP code; detail is the API’s error body, which is a
string for simple errors and an object for structured ones — check before assuming a shape.
import { AuraApiError } from "@strangeworks/aura-sdk";
try { await aura.getProject(projectId);} catch (err) { if (err instanceof AuraApiError) { if (err.status === 401) throw new Error("key missing or revoked"); if (err.status === 404) return null; // no such project if (err.status === 429) return retryLater(); // rate limited } throw err;}from aura_sdk import AuraApiError
try: await aura.get_project(project_id)except AuraApiError as err: if err.status == 401: raise RuntimeError("key missing or revoked") from err if err.status == 404: return None if err.status == 429: return await retry_later() raiseAn unreadable response
Section titled “An unreadable response”AuraResponseError means the call reached Aura and came back, but the body was not what the
contract promises — an empty body where one was required, or a payload that is not the JSON it
claimed. It is distinct from AuraApiError, which is the API deliberately rejecting you.
status is set only when it is known, so check it rather than assume.
A turn that stopped
Section titled “A turn that stopped”Raised when the turn ended before completing, either because you aborted the wait or because the server marked the reply partial. Whatever the agent produced is attached.
import { AuraTurnCancelledError } from "@strangeworks/aura-sdk";
try { const reply = await aura.chat(project.id, "Solve this.", { signal }); return reply.content;} catch (err) { if (err instanceof AuraTurnCancelledError) { return err.partialContent ?? "(the agent stopped before writing anything)"; } throw err;}from aura_sdk import AuraTurnCancelledError
try: reply = await aura.chat(project.id, "Solve this.") return reply.contentexcept AuraTurnCancelledError as cancelled: return cancelled.partial_content or "(the agent stopped before writing anything)"A wait that elapsed
Section titled “A wait that elapsed”import { AuraTurnTimeoutError } from "@strangeworks/aura-sdk";
try { return await aura.chat(project.id, "Solve this.", { timeoutMs: 10 * 60_000 });} catch (err) { if (err instanceof AuraTurnTimeoutError) { console.warn(`still running after ${String(err.timeoutMs)}ms`); await aura.cancel(project.id, err.conversationId); // or keep polling instead } throw err;}from aura_sdk import AuraTurnTimeoutError
try: return await aura.chat(project.id, "Solve this.", timeout=10 * 60)except AuraTurnTimeoutError as timed_out: print(f"still running after {timed_out.timeout}s") await aura.cancel(project.id, timed_out.conversation_id) # or keep polling raiseThe elapsed wait is in milliseconds in TypeScript (timeoutMs) and seconds in Python
(timeout).
Catching everything
Section titled “Catching everything”import { AuraError } from "@strangeworks/aura-sdk";
try { await runPipeline();} catch (err) { if (err instanceof AuraError) { console.error(`Aura: ${err.name}: ${err.message}`); } throw err;}from aura_sdk import AuraError
try: await run_pipeline()except AuraError as err: logger.exception("Aura call failed: %s", type(err).__name__) raiseIn the CLI
Section titled “In the CLI”Non-2xx responses print as a plain error message and exit 1. Cancelling a turn with Ctrl-C during
aura chat --message stops the turn server-side and exits 130.