diff options
| author | kdam0 <kumar.damani@mail.utoronto.ca> | 2017-02-02 01:55:12 +0000 |
|---|---|---|
| committer | kdam0 <kumar.damani@mail.utoronto.ca> | 2017-02-02 01:55:12 +0000 |
| commit | e78238959da75e4574bb4bbd4dc1c4433d02785b (patch) | |
| tree | b62a9302cf1e450953d1fddc64b368727b61086b /node_simple.js | |
| parent | 98c9cbc6258f699fc944f025230c35faf8575bc2 (diff) | |
better error handling and clean up
Diffstat (limited to 'node_simple.js')
| -rw-r--r-- | node_simple.js | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/node_simple.js b/node_simple.js index e991515..1061464 100644 --- a/node_simple.js +++ b/node_simple.js @@ -117,7 +117,6 @@ var uri = exports.uri = 'mongodb://general:assignment4@ds057862.mlab.com:57862/ exports.setupDB = function (callback) { mongoFactory.getConnection(uri).then(function (database) { db = database; - // var corses = exports.find_all_course_codes_from_exams(); callback(true, "Database connected"); // signal start of app }).catch(function (err) { @@ -659,10 +658,9 @@ exports.updatePassword = function (email, password, callback) { exports.find_all_course_codes_from_exams = function (callback) { var exams = db.collection('exams'); exams.distinct("course_code", function (err, result) { - if (err) throw console.log(err); + if (err) callback(false, "Failed to get unique courses"); else { - // console.log(result); - callback(result); + callback(true, result); } }); |
