Skip to content

Commit 3d0f4f8

Browse files
author
Junhui Tong
committed
fix error when reading info file if it doesn't exist
1 parent c6401ce commit 3d0f4f8

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

excel_tracker.ts

+12-5
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,17 @@ export async function getActiveExcelRow() {
5454
// wait the file to be created
5555
await new Promise(resolve => setTimeout(resolve, 500))
5656
// read output from script
57-
const s = Deno.readTextFileSync(infoFile)
58-
const [hs, vs] = s.split('_@@RS@@_')
59-
return {
60-
headings: hs.split('_@@HS@@_'),
61-
data: vs.split('_@@VS@@_')
57+
try {
58+
const s = Deno.readTextFileSync(infoFile)
59+
const [hs, vs] = s.split('_@@RS@@_')
60+
return {
61+
headings: hs.split('_@@HS@@_'),
62+
data: vs.split('_@@VS@@_')
63+
}
64+
} catch (_e) {
65+
return {
66+
headings: [],
67+
data: []
68+
}
6269
}
6370
}

0 commit comments

Comments
 (0)