Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

Remove Apify.main error message prefix

Ondra Urbaneb593e4d9795
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 234475126..3b6d1353c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -168,6 +168,8 @@ Full list of changes:
Use `request.noRetry = true`.
- Removed `RequestListOptions.persistSourcesKey` (deprecated in Feb 2020)
Use `persistRequestsKey`.
+- Removed the `The function passed to Apify.main() threw an exception` error message,
+ because it was confusing to users.
0.22.0 / 2020/12/07
====================
diff --git a/src/actor.js b/src/actor.js
index f91bb21cc..27134b854 100644
--- a/src/actor.js
+++ b/src/actor.js
@@ -181,8 +181,8 @@ export const main = (userFunc) => {
// This is to enable unit tests where process.exit() is mocked and doesn't really exit the process
// Note that mocked process.exit() might throw, so set exited flag before calling it to avoid confusion.
let exited = false;
- const exitWithError = (err, exitCode, message) => {
- log.exception(err, message);
+ const exitWithError = (err, exitCode) => {
+ log.exception(err);
exited = true;
// console.log(`Exiting with code: ${exitCode}`);
process.exit(exitCode);
@@ -208,13 +208,13 @@ export const main = (userFunc) => {
stopEvents();
clearInterval(intervalId);
if (!exited) {
- exitWithError(err, EXIT_CODES.ERROR_USER_FUNCTION_THREW, 'The function passed to Apify.main() threw an exception:');
+ exitWithError(err, EXIT_CODES.ERROR_USER_FUNCTION_THREW);
}
}
};
run().catch((err) => {
- exitWithError(err, EXIT_CODES.ERROR_UNKNOWN, 'Unknown error occurred');
+ exitWithError(err, EXIT_CODES.ERROR_UNKNOWN);
});
};
diff --git a/website/i18n/en.json b/website/i18n/en.json
index 80cb4c9a6..834c6aafd 100644
--- a/website/i18n/en.json
+++ b/website/i18n/en.json
@@ -362,9 +362,6 @@
"version-0.22.4/api/version-0.22.4-log": {
"title": "utils.log"
},
- "version-0.22.4/api/version-0.22.4-playwright-crawler": {
- "title": "PlaywrightCrawler"
- },
"version-0.22.4/api/version-0.22.4-proxy-configuration": {
"title": "ProxyConfiguration"
},