Skip to content

API Reference parrot_formdesigner.core.tenant_errors

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_formdesigner.core.tenant_errors

View source

Typed tenant error responses shared by the API and UI layers (FEAT-421).

Every tenant-aware call site raises one of these instead of hand-rolling JSONResponse({"error": ...}, status=...) inline. Each exception renders the stable JSON body contract navigator-svelte branches on:

{
  "error": "tenant_not_declared",
  "message": "This endpoint requires an explicit tenant.",
  "expected": "/api/v1/{tenant}/forms/{form_uid}"
}

These classes subclass aiohttp.web.HTTPException so they can be raised directly from a decorator or handler and aiohttp will render them as the HTTP response.

Class TenantConflictError

400 — the body declared a tenant differing from the URL.

Raised when a POST/PUT/PATCH body carries a tenant value that does not match the tenant declared in the URL path.

Parameter Type Default Description
expected str | None None Optional hint describing the expected URL shape.

Class TenantForbiddenError

403 — the caller is not entitled to the declared tenant.

Raised when the declared tenant is not among the caller's session["session"]["programs"] and the caller is not a superuser.

Parameter Type Default Description
expected str | None None Optional hint describing the expected URL shape.

Class TenantNotDeclaredError

400 — the request carried no tenant segment.

Raised when a forms route is reached without a tenant value in request.match_info (absent or empty).

Parameter Type Default Description
expected str | None None Optional hint describing the expected URL shape, e.g. "/api/v1/{tenant}/forms/{form_uid}".

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally