Skip to content

Commit

Permalink
Do not error out when logging in times out
Browse files Browse the repository at this point in the history
  • Loading branch information
gausie committed Jun 26, 2024
1 parent 75ffbcf commit 682303b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/excavator-web/etl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,17 @@ function applyFixes(data: SpadingData) {
return data;
}

async function resultOrError<T>(promise: Promise<T>, onError: T) {
try {
return await promise;
} catch (error) {
return onError;
}
}

async function main() {
if (!(await login())) {
console.log("Can't log in, probably rollover");
if (!resultOrError(login(), false)) {
console.warn("Can't log in, probably rollover");
return;
}

Expand Down

0 comments on commit 682303b

Please sign in to comment.