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:
Akhil
2026-04-22 03:30:12 +05:30
committed by GitHub
parent f4cb1ead4e
commit cb4a06ce5c
2 changed files with 7 additions and 4 deletions

View File

@@ -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}`;
} }
}, },

View File

@@ -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.`
);
} }
} }