Browse Source

Added quick way to prevent server from crashing when there is an error.

KrisVos130 8 years ago
parent
commit
8460689b45
2 changed files with 4 additions and 3 deletions
  1. 4 0
      backend/index.js
  2. 0 3
      backend/logic/actions/stations.js

+ 4 - 0
backend/index.js

@@ -14,6 +14,10 @@ const cache = require('./logic/cache');
 const notifications = require('./logic/notifications');
 const config = require('config');
 
+process.on('uncaughtException', function (err) {
+	console.log('ERROR: ', err);
+});
+
 async.waterfall([
 
 	// setup our Redis cache

+ 0 - 3
backend/logic/actions/stations.js

@@ -92,7 +92,6 @@ module.exports = {
 			for (let prop in stations) {
 				// TODO If community, check if on whitelist
 				let station = stations[prop];
-				console.log(station)
 				if (station.privacy === 'public') add(true, station);
 				else if (!session.sessionId) add(false);
 				else {
@@ -113,11 +112,9 @@ module.exports = {
 			}
 
 			function add(add, station) {
-				console.log("ADD!", add, station);
 				if (add) arr.push(station);
 				done++;
 				if (done === Object.keys(stations).length) {
-					console.log("DONE!", done);
 					cb({ status: 'success', stations: arr });
 				}
 			}