Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…ymore.
  • Loading branch information...
commit 64c39ba6760d1b8e7a2bcf83355e12f86e4f259c 1 parent 24b1c2a
@iapain authored
Showing with 9 additions and 7 deletions.
  1. +9 −7 tools/doc/json.js
View
16 tools/doc/json.js
@@ -160,7 +160,7 @@ 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)
@@ -168,17 +168,19 @@ function doJSON(input, filename, outfile, cb) {
}
// 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};
Please sign in to comment.
Something went wrong with that request. Please try again.