Every SDK method throws TerrantulaError on a non-2xx response. It carries the HTTP status and the parsed response body.
| Property | Type | Description |
|---|---|---|
status | number | HTTP status code (e.g. 401, 404, 422). |
body | unknown | Parsed JSON response body. Inspect for body.error for the error string. |
message | string | Human-readable message. Extracted from body.error when present; falls back to "Request failed with status N". |
withSchema attaches a Zod schema to a function. This is used internally by the CLI's command auto-discovery. In most cases you won't need it directly unless you're building tooling on top of the SDK.
SchemaFn<S, R> is ((params: z.infer<S>) => Promise<R>) & { readonly schema: S }. It preserves the call signature while adding .schema for introspection.