@blockchaincommons/lifehash - v1.0.0-beta.2
    Preparing search index...

    Class LifeHashError

    Thrown for an unknown version name (InvalidVersion), a module size that is not a positive integer or whose image would hold more bytes than a number can count (InvalidModuleSize), a digest that is not 32 bytes (InvalidDigestLength), and an argument of the wrong type (InvalidArgument). Every check runs before any rendering. Instances come from the static factories only.

    try {
    makeFromUtf8(text, { version: name });
    } catch (e) {
    if (LifeHashError.isLifeHashError(e) && e.is("InvalidVersion")) {
    // name is not a LifeHash version
    }
    }

    Hierarchy

    • Error
      • LifeHashError
    Index
    name: "LifeHashError"

    Always "LifeHashError"; the cross-copy identity LifeHashError.isLifeHashError checks.

    The discriminant; equals details.code.

    The structured payload, discriminated by code.

    • Type guard for a LifeHashError, including one from another copy of this package.

      Parameters

      • value: unknown

      Returns value is LifeHashError

    • value would make the image larger than 2 ** 53 - 1 bytes; max is the largest allowed.

      Parameters

      • value: number
      • max: number
      • what: string

      Returns LifeHashError