dyna-record
    Preparing search index...

    Class ConditionalCheckFailedError

    Error thrown if a condition within a dynamo operation fails. Delivered inside a TransactionWriteFailedError, one per failed item.

    A check dyna-record adds itself is reported as this class: the entity's own row is missing or already exists, a referenced entity does not exist, a relationship was changed by a concurrent write, or an id is not related. A failed write condition is reported as its subclass WriteConditionFailedError, so an existing instanceof ConditionalCheckFailedError check still catches it, and instanceof WriteConditionFailedError tells the two apart.

    try {
    await Order.update("order-1", { total: 90 });
    } catch (error) {
    if (error instanceof TransactionWriteFailedError) {
    const libraryCheckFailed = error.errors.some(
    cause =>
    cause instanceof ConditionalCheckFailedError &&
    !(cause instanceof WriteConditionFailedError)
    );
    console.log(libraryCheckFailed);
    }
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Constructors

    Properties

    code: "ConditionalCheckFailedError" | "WriteConditionFailedError" = "ConditionalCheckFailedError"

    Widened to every subclass's code, so a subclass can narrow it. An instance of this class itself always carries "ConditionalCheckFailedError", and a WriteConditionFailedError carries "WriteConditionFailedError". Comparing code and testing instanceof work for either class; only code that assigns code to a variable typed as the single literal "ConditionalCheckFailedError" needs to widen that variable.