Skip to content

basalt / tenancy/src / TenantAlreadyExistsError

Class: TenantAlreadyExistsError ​

Defined in: tenancy/src/tenant.ts:357

tenancy.create() (or basalt tenant:create, or a source's create()) for an id that already exists. 409: the request conflicts with a record that is there, and repeating it will not change that.

Refused rather than overwritten. Creating over an existing tenant used to go through the durable sources' upsert, which replaced the whole record — the owner, the plan, a suspended status — and then ran onProvision again on storage that already held a customer's data. A signup form that submits twice must not be able to do that.

status is the existing record's, when the caller knows it. A failed or provisioning tenant is the one case where "create it again" is a reasonable instinct, so the message names the method that actually finishes the job.

Extends ​

Constructors ​

Constructor ​

> new TenantAlreadyExistsError(id, existingStatus?): TenantAlreadyExistsError

Defined in: tenancy/src/tenant.ts:359

Parameters ​

id ​

string

existingStatus? ​

TenantStatus

Returns ​

TenantAlreadyExistsError

Overrides ​

BasaltError.constructor

Properties ​

code ​

> readonly code: string

Defined in: core/src/errors.ts:25

Inherited from ​

BasaltError.code


details? ​

> readonly optional details?: Record<string, unknown>

Defined in: core/src/errors.ts:28

Structured payload passed to the constructor, exactly as given (never sanitised here).

Inherited from ​

BasaltError.details


status ​

> readonly status: 409 = 409

Defined in: tenancy/src/tenant.ts:358

Released under the MIT License.