From e78238959da75e4574bb4bbd4dc1c4433d02785b Mon Sep 17 00:00:00 2001 From: kdam0 Date: Wed, 1 Feb 2017 20:55:12 -0500 Subject: better error handling and clean up --- node_simple.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'node_simple.js') 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); } }); -- cgit v1.2.3