Ditto JS SDK v5.0.0
    Preparing search index...

    Class DittoError

    DittoError is a subclass of the default Javascript Error. You can identify specific errors programatically using the code property.

    Please reference ERROR_CODES for a comprehensive list of possible error codes in this SDK version.

    Handling a specific error code:

    import { Attachment, DittoError } from '@dittolive/ditto'

    let attachment: Attachment
    try {
    attachment = await ditto.store.newAttachment(filePath)
    } catch (error) {
    if (error instanceof DittoError && error.code === 'store/attachment-file-not-found') {
    // Handle a non-existing file
    }
    throw error // Rethrow any other error
    }

    Hierarchy

    • Error
      • DittoError
    Index

    Properties

    Properties

    code:
        | "internal"
        | "unknown"
        | "unsupported"
        | "authentication/failed-to-authenticate"
        | "authentication/expiration-handler-missing"
        | "io/already-exists"
        | "io/not-found"
        | "io/permission-denied"
        | "io/operation-failed"
        | "query/arguments-invalid"
        | "query/evaluation"
        | "query/execution"
        | "query/invalid"
        | "query/unsupported"
        | "query/parameter"
        | "store/backend"
        | "store/crdt"
        | "store/document-not-found"
        | "store/transaction-read-only"
        | "store/document-id"
        | "store/persistence-directory-locked"
        | "store/attachment-file-permission-denied"
        | "store/attachment-file-not-found"
        | "store/attachment-not-found"
        | "store/attachment-token-invalid"
        | "store/failed-to-create-attachment"
        | "store/failed-to-fetch-attachment"
        | "activation/license-token-verification-failed"
        | "activation/license-token-expired"
        | "activation/license-token-unsupported-future-version"
        | "activation/not-activated"
        | "activation/unnecessary"
        | "validation/depth-limit-exceeded"
        | "validation/invalid-cbor"
        | "validation/invalid-json"
        | "validation/invalid-transport-config"
        | "validation/invalid-ditto-config"
        | "validation/not-an-object"
        | "validation/not-json-compatible"
        | "validation/size-limit-exceeded"
        | "encryption/extraneous-passphrase-given"
        | "differ/identity-key-path-invalid"

    Use the error code to identify a specific error programatically.

    ERROR_CODES for a comprehensive list of possible error codes in this SDK version.

    stack?: string

    Some environments provide a stack trace that is attached to any error.