Skip to content

Commit

Permalink
fix: hide ENOENT error
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Mar 24, 2018
1 parent 8cc7758 commit fc5ce41
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/hooks/init/check_update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ const hook: Hook<'init'> = async function ({config}) {
}

const refreshNeeded = async () => {
const {mtime} = await fs.stat(file)
const staleAt = new Date(mtime.valueOf() + 1000 * 60 * 60 * 24)
return staleAt < new Date()
try {
const {mtime} = await fs.stat(file)
const staleAt = new Date(mtime.valueOf() + 1000 * 60 * 60 * 24)
return staleAt < new Date()
} catch (err) {
debug(err)
return true
}
}

const spawnRefresh = async () => {
Expand Down

0 comments on commit fc5ce41

Please sign in to comment.