2013-05-09 05:28:24 +00:00
|
|
|
(function(RedisDB) {
|
|
|
|
|
var PRODUCTION = false,
|
|
|
|
|
ERROR_LOGS = true,
|
|
|
|
|
|
|
|
|
|
redis = require('redis'),
|
|
|
|
|
config = require('../config.js');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RedisDB.exports = redis.createClient(config.redis.port, config.redis.host, config.redis.options);
|
|
|
|
|
|
|
|
|
|
RedisDB.exports.handle = function(error) {
|
|
|
|
|
if (error !== null) {
|
|
|
|
|
if (PRODUCTION === false) {
|
|
|
|
|
console.log("################# ERROR LOG ####################");
|
|
|
|
|
console.log(error);
|
|
|
|
|
console.log(arguments.callee.name);
|
|
|
|
|
console.log("################# ERROR LOG ####################");
|
2013-05-09 05:48:55 +00:00
|
|
|
throw new Error('RedisDB Error: ' + error);
|
2013-05-09 05:28:24 +00:00
|
|
|
} else if (ERROR_LOGS === true) {
|
|
|
|
|
console.log('RedisDB Error: ' + error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}(module));
|