| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c52d886 commit a836d3b
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,27 +1,24 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | const common = require('../common'); | |
| 3 | - var assert = require('assert'); | ||
| 4 | - var fs = require('fs'); | ||
| 3 | + const assert = require('assert'); | ||
| 4 | + const fs = require('fs'); | ||
| 5 | + | ||
| 6 | + let caughtException = false; | ||
| 5 | 7 | ||
| 6 | - var caughtException = false; | ||
| 7 | 8 | try { | |
| 8 | 9 | // should throw ENOENT, not EBADF | |
| 9 | 10 | // see https://github.com/joyent/node/pull/1228 | |
| 10 | 11 | fs.openSync('/path/to/file/that/does/not/exist', 'r'); | |
| 11 | 12 | } catch (e) { | |
| 12 | - assert.equal(e.code, 'ENOENT'); | ||
| 13 | + assert.strictEqual(e.code, 'ENOENT'); | ||
| 13 | 14 | caughtException = true; | |
| 14 | 15 | } | |
| 15 | - assert.ok(caughtException); | ||
| 16 | + assert.strictEqual(caughtException, true); | ||
| 16 | 17 | ||
| 17 | - fs.open(__filename, 'r', common.mustCall(function(err, fd) { | ||
| 18 | - if (err) { | ||
| 19 | - throw err; | ||
| 20 | - } | ||
| 18 | + fs.open(__filename, 'r', common.mustCall((err) => { | ||
| 19 | + assert.ifError(err); | ||
| 21 | 20 | })); | |
| 22 | 21 | ||
| 23 | - fs.open(__filename, 'rs', common.mustCall(function(err, fd) { | ||
| 24 | - if (err) { | ||
| 25 | - throw err; | ||
| 26 | - } | ||
| 22 | + fs.open(__filename, 'rs', common.mustCall((err) => { | ||
| 23 | + assert.ifError(err); | ||
| 27 | 24 | })); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments