log errors only once, fixes #140

also made sure some (network) errors have level 'WARN'
these are printed without stacktrace
This commit is contained in:
jomo
2015-09-20 20:49:37 +02:00
parent b97087c099
commit 26f6b089ef
9 changed files with 16 additions and 34 deletions

View File

@@ -1,4 +1,3 @@
var logging = require("../logging");
var helpers = require("../helpers");
var config = require("../../config");
var skins = require("../skins");
@@ -82,7 +81,6 @@ module.exports = function(req, callback) {
try {
helpers.get_avatar(req.id, userId, helm, size, function(err, status, image, hash) {
if (err) {
logging.error(req.id, err);
if (err.code === "ENOENT") {
// no such file
cache.remove_hash(req.id, userId);
@@ -101,7 +99,6 @@ module.exports = function(req, callback) {
}
});
} catch (e) {
logging.error(req.id, "error:", e.stack);
handle_default(-1, userId, size, def, req, e, callback);
}
};

View File

@@ -32,7 +32,6 @@ module.exports = function(req, callback) {
try {
helpers.get_cape(rid, userId, function(err, hash, status, image) {
if (err) {
logging.error(rid, err);
if (err.code === "ENOENT") {
// no such file
cache.remove_hash(rid, userId);

View File

@@ -98,7 +98,6 @@ module.exports = function(req, callback) {
try {
helpers.get_render(rid, userId, scale, helm, body, function(err, status, hash, image) {
if (err) {
logging.error(rid, err);
if (err.code === "ENOENT") {
// no such file
cache.remove_hash(rid, userId);
@@ -118,7 +117,6 @@ module.exports = function(req, callback) {
}
});
} catch(e) {
logging.error(rid, "error:", e.stack);
handle_default(rid, scale, helm, body, -1, userId, scale, def, req, e, callback);
}
};

View File

@@ -81,7 +81,6 @@ module.exports = function(req, callback) {
try {
helpers.get_skin(rid, userId, function(err, hash, status, image) {
if (err) {
logging.error(req.id, err);
if (err.code === "ENOENT") {
// no such file
cache.remove_hash(req.id, userId);
@@ -100,7 +99,6 @@ module.exports = function(req, callback) {
}
});
} catch(e) {
logging.error(rid, "error:", e.stack);
handle_default(-1, userId, def, req, e, callback);
}
};