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.

Better logging of errors in Apify.main()

Jan Curnc789090eba80
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 096f0f7d6..144f49c05 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+xxx
+===================
+- Better logging of errors in `Apify.main()`
+
0.14.2 / 2019-04-25
===================
- Fix invalid type check in `puppeteerModule`.
diff --git a/src/actor.js b/src/actor.js
index 2fd84ec04..2c20d5b16 100644
--- a/src/actor.js
+++ b/src/actor.js
@@ -236,8 +236,7 @@ export const main = (userFunc) => {
// 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) => {
- console.error(message);
- console.error(err.stack || err);
+ log.exception(err, message);
exited = true;
// console.log(`Exiting with code: ${exitCode}`);
process.exit(exitCode);