Skip to content

Commit fd55f27

Browse files
Copilotbarjin
andcommitted
fix: revert try-catch from getCookies and getCookieString in session
Co-authored-by: barjin <61918049+barjin@users.noreply.github.com>
1 parent 36d82f7 commit fd55f27

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

packages/core/src/session_pool/session.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -346,13 +346,8 @@ export class Session implements ISession {
346346
* @param url website url. Only cookies stored for this url will be returned
347347
*/
348348
getCookies(url: string): CookieObject[] {
349-
try {
350-
const cookies = this.cookieJar.getCookiesSync(url);
351-
return cookies.map((c) => toughCookieToBrowserPoolCookie(c));
352-
} catch (e) {
353-
this.log.warning('Could not get cookies from cookie jar.', { url, error: (e as Error).message });
354-
return [];
355-
}
349+
const cookies = this.cookieJar.getCookiesSync(url);
350+
return cookies.map((c) => toughCookieToBrowserPoolCookie(c));
356351
}
357352

358353
/**
@@ -362,12 +357,7 @@ export class Session implements ISession {
362357
* @returns Represents `Cookie` header.
363358
*/
364359
getCookieString(url: string): string {
365-
try {
366-
return this.cookieJar.getCookieStringSync(url, {});
367-
} catch (e) {
368-
this.log.warning('Could not get cookie string.', { url, error: (e as Error).message });
369-
return '';
370-
}
360+
return this.cookieJar.getCookieStringSync(url, {});
371361
}
372362

373363
/**

0 commit comments

Comments
 (0)