Skip to content

StoreError

How every storage contract fails: one StoreError naming the store and the operation, whose reason says what happened. Storage that failed is Failed, with its cause; a write that disagrees with what is stored, such as a malformed or foreign record, a reused ID, or an idempotency key recorded with other content, is Rejected; and storage another writer held or changed meanwhile, which asking again may get past, is Contended. A caller answers contention by asking again, or by telling its own caller that storage is busy, and treats the rest as defects.

Since v0.2.0

Another writer held or changed what the store’s operation needed, as description says.

Signature

declare const contended: (store: string, operation: string, description: string) => StoreError

Source

Since v0.2.0

Report a cause as the store’s failed operation, for Effect.mapError. A cause that is already a store’s error, such as the workspace binding’s, keeps its reason, so contention stays contention.

Signature

declare const failed: (store: string, operation: string) => (cause: unknown) => StoreError

Source

Since v0.2.0

The store’s operation refused a write, as description says.

Signature

declare const rejected: (store: string, operation: string, description: string) => StoreError

Source

Since v0.2.0

Another writer held storage, or changed what the write expected, meanwhile, as description says. Nothing was written, and asking again may get past it.

Signature

declare class Contended

Source

Since v0.2.0

Storage failed while reading or writing, for the cause given.

Signature

declare class Failed

Source

Since v0.2.0

The write disagrees with what is stored or with the workspace, as description says: a malformed or foreign input, a reused ID, a missing record, or an idempotency key recorded with other content. Nothing was written.

Signature

declare class Rejected

Source

Since v0.2.0

A store’s operation failed, for the reason given. store and operation name where, as ThreadStore and insert.

Signature

declare class StoreError

Source

Since v0.2.0

Whether u is a store’s error.

Signature

declare const isStoreError: (u: unknown) => u is StoreError

Source

Since v0.2.0

Why a store’s operation failed: one of the reasons above.

Signature

declare const Reason: Schema.toTaggedUnion<"_tag", readonly [typeof Failed, typeof Rejected, typeof Contended]>

Source

Since v0.2.0

Signature

type Reason = typeof Reason.Type

Source

Since v0.2.0