continue-custom/core/util/errors.ts
Fred Bricon 1dc58c63ab fix: allow downloading missing embedder on Ollama, in VS Code
Signed-off-by: Fred Bricon <fbricon@gmail.com>
2025-04-17 18:17:37 +02:00

13 lines
No EOL
397 B
TypeScript

/**
* Recursively retrieves the root cause of an error by traversing through its `cause` property.
*
* @param err - The error object to analyze. It can be of any type.
* @returns The root cause of the error, or the original error if no further cause is found.
*/
export function getRootCause(err: any): any {
if (err.cause) {
return getRootCause(err.cause);
}
return err;
}