file saved as name

This commit is contained in:
DaKheera47
2026-01-08 23:54:06 +00:00
parent 585e5e19e0
commit b914026d8b
5 changed files with 37 additions and 13 deletions
+8 -7
View File
@@ -419,17 +419,18 @@ async function main(): Promise<void> {
try {
response = await fetchPage(pageNo, authSession, { searchKeyword });
} catch (error) {
if (error instanceof UkVisaJobsAuthError) {
if (!credentials) {
if (!credentials) {
if (error instanceof UkVisaJobsAuthError) {
throw new Error('UKVisaJobs auth expired. Set UKVISAJOBS_EMAIL and UKVISAJOBS_PASSWORD to refresh.');
}
console.log(' Auth expired. Refreshing tokens...');
authSession = await loginWithBrowser(credentials.email, credentials.password);
await saveCachedAuthSession(authSession);
response = await fetchPage(pageNo, authSession, { searchKeyword });
} else {
throw error;
}
const reason = error instanceof UkVisaJobsAuthError ? 'Auth expired.' : 'Fetch failed.';
console.log(` ${reason} Refreshing tokens and retrying...`);
authSession = await loginWithBrowser(credentials.email, credentials.password);
await saveCachedAuthSession(authSession);
response = await fetchPage(pageNo, authSession, { searchKeyword });
}
if (response.status !== 1) {