langchain.js
    Preparing search index...

    Class MiddlewareError

    Error thrown when a middleware fails.

    Use MiddlewareError.wrap() to create instances. The constructor is private to ensure that GraphBubbleUp errors (like GraphInterrupt) are never wrapped.

    Hierarchy

    • Error
      • MiddlewareError
    Index

    Properties

    Methods

    Properties

    "~brand": "MiddlewareError"

    Methods

    • Check if the error is a MiddlewareError.

      Parameters

      • error: unknown

        The error to check

      Returns error is MiddlewareError

      Whether the error is a MiddlewareError

    • Wrap an error in a MiddlewareError, unless it's a GraphBubbleUp error (like GraphInterrupt) which should propagate unchanged.

      Parameters

      • error: unknown

        The error to wrap

      • middlewareName: string

        The name of the middleware that threw the error

      Returns Error

      The original error if it's a GraphBubbleUp, otherwise a new MiddlewareError