rubber-blueR
Apify & Crawlee15mo ago
3 replies
rubber-blue

How to override `maxRequestRetries` error log

there is a function
    protected async _handleFailedRequestHandler(crawlingContext: Context, error: Error): Promise<void> {
        // Always log the last error regardless if the user provided a failedRequestHandler
        const { id, url, method, uniqueKey } = crawlingContext.request;
        const message = this._getMessageFromError(error, true);

        this.log.error(`Request failed and reached maximum retries. ${message}`, { id, url, method, uniqueKey });

        if (this.failedRequestHandler) {
            await this._tagUserHandlerError(() =>
                this.failedRequestHandler?.(this._augmentContextWithDeprecatedError(crawlingContext, error), error),
            );
        }
    }


that is triggered once maxRequestRetries is done, how could I override this log message with my own? I don't want to see whole stacktrace in my logs, I just want to notify that there is an error and details can be found under some id in DB

should I disable logs for error and handle them manually?
Was this page helpful?