mirror of
https://github.com/Mintplex-Labs/anything-llm
synced 2026-04-25 17:15:37 +02:00
fix: surface readable error messages in web-scraping agent and ai-provider (#5476)
* fix: surface readable error messages in web-scraping agent and ai-provider * simplify --------- Co-authored-by: Timothy Carambat <rambat1010@gmail.com>
This commit is contained in:
@@ -49,13 +49,14 @@ const webScraping = {
|
|||||||
if (url) return await this.scrape(url);
|
if (url) return await this.scrape(url);
|
||||||
return "There is nothing we can do. This function call returns no information.";
|
return "There is nothing we can do. This function call returns no information.";
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
const errorMessage = error?.message ?? JSON.stringify(error);
|
||||||
this.super.handlerProps.log(
|
this.super.handlerProps.log(
|
||||||
`Web Scraping Error: ${error.message}`
|
`Web Scraping Error: ${errorMessage}`
|
||||||
);
|
);
|
||||||
this.super.introspect(
|
this.super.introspect(
|
||||||
`${this.caller}: Web Scraping Error: ${error.message}`
|
`${this.caller}: Web Scraping Error: ${errorMessage}`
|
||||||
);
|
);
|
||||||
return `There was an error while calling the function. No data or response was found. Let the user know this was the error: ${error.message}`;
|
return `There was an error while calling the function. No data or response was found. Let the user know this was the error: ${errorMessage}`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -406,7 +406,9 @@ class Provider {
|
|||||||
...config,
|
...config,
|
||||||
});
|
});
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unsupported provider ${provider} for this task.`);
|
throw new Error(
|
||||||
|
`Unsupported provider ${JSON.stringify(provider)} for this task.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user