Skip to content

Commit

Permalink
fix: do not hide stack trace of (retried) Type/Syntax/ReferenceErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
B4nan committed Sep 9, 2022
1 parent 7b33b0a commit 469b4b5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/basic-crawler/src/internals/basic-crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,10 @@ export class BasicCrawler<Context extends CrawlingContext = BasicCrawlingContext
* @returns The message to be logged
*/
protected _getMessageFromError(error: Error, forceStack = false) {
if ([TypeError, SyntaxError, ReferenceError].some((type) => error instanceof type)) {
forceStack = true;
}

// For timeout errors we want to show the stack just in case the env variable is set
if (error instanceof TimeoutError) {
return process.env.CRAWLEE_VERBOSE_LOG ? error.stack : error.message || error;
Expand Down

0 comments on commit 469b4b5

Please sign in to comment.