Base error class for all LangChain errors.
All LangChain error classes should extend this class (directly or
indirectly). Use LangChainError.isInstance(obj) to check if an
object is any LangChain error.
class LangChainErrortry {
await model.invoke("hello");
} catch (error) {
if (LangChainError.isInstance(error)) {
console.log("Got a LangChain error:", error.message);
}
}The underlying error that caused this ContextOverflowError, if any.
This property is optionally set when wrapping a lower-level error using ContextOverflowError.fromError. It allows error handlers to access or inspect the original error that led to the context overflow.