Skip to content

Commit dd415d0

Browse files
committed
feature(writejson) rm extra tryCatch
1 parent 9f5b433 commit dd415d0

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

lib/writejson.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ var fs = require('fs'),
44
tryCatch = require('try-catch');
55

66
module.exports = function(name, json, options, callback) {
7+
var str;
8+
79
if (!callback) {
810
callback = options;
911
options = {};
@@ -12,15 +14,8 @@ module.exports = function(name, json, options, callback) {
1214
check(name, json, options);
1315
checkCB(callback);
1416

15-
var str,
16-
error = tryCatch(function() {
17-
str = stringify(json, options);
18-
});
19-
20-
if (error)
21-
callback(error);
22-
else
23-
fs.writeFile(name, str, callback);
17+
str = stringify(json, options);
18+
fs.writeFile(name, str, callback);
2419
};
2520

2621
module.exports.sync = sync;

0 commit comments

Comments
 (0)