In PlaywrightCrawler.failedRequestHandler() the error argument contains no information about error #1755
-
Which package is this bug report for? If unsure which one to select, leave blankNone Issue descriptionI need access to the information about error in my code, so I use But the Attached the code to reproduce this. I changed the
And when I print the contents of the
Well, Code sampleimport { firefox, webkit } from 'playwright';
import { PlaywrightCrawler, Dataset, ProxyConfiguration, Request, log, sleep } from 'crawlee';
import { launchPlaywright, playwrightUtils } from 'crawlee';
import * as crypt from 'crypto';
const crawler = new PlaywrightCrawler({
maxRequestRetries: 0,
navigationTimeoutSecs: 25,
requestHandlerTimeoutSecs: 20,
useSessionPool: false,
persistCookiesPerSession: false,
headless: true,
browserPoolOptions: {
useFingerprints: true,
operationTimeoutSecs: 30,
},
launchContext: {
useIncognitoPages: true,
launcher: firefox
},
async requestHandler( {request, response, page, enqueueLinks, log, proxyInfo} )
{
let scrFile = `httpbin-${request.uniqueKey}.png`;
await sleep(15*1000);
log.info(`GET ${request.url} Writing into ${scrFile} ...`);
await page.screenshot( {path:scrFile, fullPage:false} );
log.info(`GET ${request.url} DONE`);
},
async errorHandler({request, response, page, log}, error)
{
let errorStr = JSON.stringify(error);
log.warning(`errorHandler: error=${errorStr}` );
},
async failedRequestHandler({request, response, page, log}, error) {
let errorStr = JSON.stringify(error);
log.warning(`failedRequestHandler: error=${errorStr}` );
},
});
await crawler.addRequests([ new Request({ url: "https://httpbin.or/headers#gsphgfh", uniqueKey: "gsphgfh" }) ]);
await crawler.run([]); Package versionNode.js versionnode v16.19.0, [email protected] Operating systemUbuntu Apify platform
I have tested this on the
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The same error info is there, it just gets lost when you convert the error object to JSON. That's how errors works in JS, not really a problem on our end: The problem here is that the error properties like |
Beta Was this translation helpful? Give feedback.
The same error info is there, it just gets lost when you convert the error object to JSON. That's how errors works in JS, not really a problem on our end:
The problem here is that the error properties like
message
orstack
are not enumerable, so they won't make it into the JSON string.