close context if encounter error

This commit is contained in:
Hongbo Wu
2022-07-15 11:49:36 +08:00
parent 610c790a7e
commit 4929bae81b

View File

@ -553,6 +553,7 @@ async function retrievePage(url) {
if (lastPdfUrl) {
return { context, page, finalUrl: lastPdfUrl, contentType: 'application/pdf' };
}
await context.close();
throw error;
}
}