Permalink
Browse files

Fixed some typos. `writeOutputToFile` does not raise and exception an…

…ymore.
  • Loading branch information...
1 parent 24b1c2a commit 64c39ba6760d1b8e7a2bcf83355e12f86e4f259c @iapain committed Mar 14, 2013
Showing with 9 additions and 7 deletions.
  1. +9 −7 tools/doc/json.js
View
@@ -160,25 +160,27 @@ function doJSON(input, filename, outfile, cb) {
}
if (outfile) {
- writeOututToFile(root, filename, outfile, indexfile, writeToIndexFile);
+ writeOutputToFile(root, filename, outfile, indexfile, writeToIndexFile);
}
else {
return cb(null, root)
}
}
// write output object to outfile
-function writeOututToFile(obj, sourcefile, outfile, indexfile, cb) {
+function writeOutputToFile(obj, sourcefile, outfile, indexfile, cb) {
fs.writeFile(outfile, JSON.stringify(obj, null, 2), function(err) {
- if(err) {
- throw new Error('error saving file - '+ err);
- }
- cb(obj, sourcefile, path.join(path.dirname(outfile), indexfile));
+ cb(err, obj, sourcefile, path.join(path.dirname(outfile), indexfile));
});
}
// make an entry into index file
-function writeToIndexFile(root, sourcefile, outfile) {
+function writeToIndexFile(err, root, sourcefile, outfile) {
+ // check if there was an error writing file
+ if (err) {
+ throw new Error('error writing file - '+ e);
+ }
+
// default type of an index
var obj = {"type":"index"};
var entry = {"source":sourcefile};

0 comments on commit 64c39ba

Please sign in to comment.