Creates a new ContextOverflowError instance from an existing error.
This static utility copies the message from the provided error and attaches the original error as the ContextOverflowError.cause property, enabling error handlers to inspect or propagate the original failure.
fromError(obj: Error): ContextOverflowError| Name | Type | Description |
|---|---|---|
obj* | Error | The original error object causing the context overflow. |
try {
await model.invoke(input);
} catch (err) {
throw ContextOverflowError.fromError(err);
}