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
Constructors
Section titled “Constructors”contended
Section titled “contended”Another writer held or changed what the store’s operation needed, as description says.
Signature
declare const contended: (store: string, operation: string, description: string) => StoreErrorSince v0.2.0
failed
Section titled “failed”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) => StoreErrorSince v0.2.0
rejected
Section titled “rejected”The store’s operation refused a write, as description says.
Signature
declare const rejected: (store: string, operation: string, description: string) => StoreErrorSince v0.2.0
Errors
Section titled “Errors”Contended (class)
Section titled “Contended (class)”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 ContendedSince v0.2.0
Failed (class)
Section titled “Failed (class)”Storage failed while reading or writing, for the cause given.
Signature
declare class FailedSince v0.2.0
Rejected (class)
Section titled “Rejected (class)”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 RejectedSince v0.2.0
StoreError (class)
Section titled “StoreError (class)”A store’s operation failed, for the reason given. store and operation name where, as
ThreadStore and insert.
Signature
declare class StoreErrorSince v0.2.0
Guards
Section titled “Guards”isStoreError
Section titled “isStoreError”Whether u is a store’s error.
Signature
declare const isStoreError: (u: unknown) => u is StoreErrorSince v0.2.0
Schemas
Section titled “Schemas”Reason
Section titled “Reason”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]>Since v0.2.0
Reason (type alias)
Section titled “Reason (type alias)”Signature
type Reason = typeof Reason.TypeSince v0.2.0