Skip to content

Commit

Permalink
fix error when reading info file if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Junhui Tong committed Jul 15, 2024
1 parent c6401ce commit 3d0f4f8
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions excel_tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,17 @@ export async function getActiveExcelRow() {
// wait the file to be created
await new Promise(resolve => setTimeout(resolve, 500))
// read output from script
const s = Deno.readTextFileSync(infoFile)
const [hs, vs] = s.split('_@@RS@@_')
return {
headings: hs.split('_@@HS@@_'),
data: vs.split('_@@VS@@_')
try {
const s = Deno.readTextFileSync(infoFile)
const [hs, vs] = s.split('_@@RS@@_')
return {
headings: hs.split('_@@HS@@_'),
data: vs.split('_@@VS@@_')
}
} catch (_e) {
return {
headings: [],
data: []
}
}
}

0 comments on commit 3d0f4f8

Please sign in to comment.