Skip to content

Commit 1e9c57d

Browse files
authored
Fix error handling in utimesMillis (#1065)
Also remove old comment
1 parent 353a29b commit 1e9c57d

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

lib/util/utimes.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@ const fs = require('../fs')
44
const u = require('universalify').fromPromise
55

66
async function utimesMillis (path, atime, mtime) {
7-
// if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
87
const fd = await fs.open(path, 'r+')
98

10-
let closeErr = null
9+
let error = null
1110

1211
try {
1312
await fs.futimes(fd, atime, mtime)
13+
} catch (futimesErr) {
14+
error = futimesErr
1415
} finally {
1516
try {
1617
await fs.close(fd)
17-
} catch (e) {
18-
closeErr = e
18+
} catch (closeErr) {
19+
error = closeErr
1920
}
2021
}
2122

22-
if (closeErr) {
23-
throw closeErr
23+
if (error) {
24+
throw error
2425
}
2526
}
2627

0 commit comments

Comments
 (0)