From 1c02d73c2c538102e1eea1c2092e8ed48bac0bdb Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Wed, 21 Jun 2017 11:24:36 +0200 Subject: [PATCH] Log client error (#225) * Log client error * Log all errors --- lib/routes/feature.js | 1 + lib/routes/metrics.js | 2 ++ lib/routes/strategy.js | 1 + 3 files changed, 4 insertions(+) diff --git a/lib/routes/feature.js b/lib/routes/feature.js index 52bf9a91af..7302b192ad 100644 --- a/lib/routes/feature.js +++ b/lib/routes/feature.js @@ -13,6 +13,7 @@ const legacyFeatureMapper = require('../data-helper/legacy-feature-mapper'); const version = 1; const handleErrors = (req, res, error) => { + logger.warn('Error creating or updating feature', error); switch (error.constructor) { case NotFoundError: return res diff --git a/lib/routes/metrics.js b/lib/routes/metrics.js index 12ed0a7ad1..6f2b232a22 100644 --- a/lib/routes/metrics.js +++ b/lib/routes/metrics.js @@ -60,6 +60,7 @@ module.exports = function (app, config) { joi.validate(data, clientMetricsSchema, (err, cleaned) => { if (err) { + logger.warn('Invalid metrics posted', err); return res.status(400).json(err); } @@ -81,6 +82,7 @@ module.exports = function (app, config) { joi.validate(data, clientRegisterSchema, (err, clientRegistration) => { if (err) { + logger.warn('Invalid client data posted', err); return res.status(400).json(err); } diff --git a/lib/routes/strategy.js b/lib/routes/strategy.js index ab0f40ff02..d18313f9e0 100644 --- a/lib/routes/strategy.js +++ b/lib/routes/strategy.js @@ -9,6 +9,7 @@ const strategySchema = require('./strategy-schema'); const version = 1; const handleError = (req, res, error) => { + logger.warn('Error creating or updating strategy', error); switch (error.name) { case 'NotFoundError': return res