@rdfjs/wrapper
    Preparing search index...

    Class TermTypeError

    Error thrown when the type of a term is unexpected.

    Code working with RDF might expect that a term (e.g. the object of a statement is of a specific term type (e.g. Literal}). When unmet, code might be strict and throw an error representing the failed expectation.

    The underlying error's term is the one whose type was unexpected.

    Consider the following mapping class, which expects a numeric literal:

    class Class extends TermWrapper {
    public get property(): number {
    return RequiredFrom.subjectPredicate(this, "p", LiteralAs.number)
    }
    }

    Given the following RDF, which does not meet the above expectation:

    <s> <p> <o> .
    

    Invoking the mapping code in the following manner:

    new Class("s", dataset, factory).property
    

    Will result in this error being throw with the following message.

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new instance of TermTypeError.

      Parameters

      • term: Term

        The term associated with this error.

      • termType: "NamedNode" | "BlankNode" | "Literal" | "Variable" | "DefaultGraph" | "Quad"

        The expected term type.

      • Optionalcause: any

        The specific original cause of the error.

      Returns TermTypeError

    Properties

    cause?: unknown
    message: string
    name: string
    stack?: string
    term: Term

    The term associated with this error.

    termType:
        | "NamedNode"
        | "BlankNode"
        | "Literal"
        | "Variable"
        | "DefaultGraph"
        | "Quad"

    The expected term type.