1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00

Log client error (#225)

* Log client error

* Log all errors
This commit is contained in:
Simen Bekkhus 2017-06-21 11:24:36 +02:00 committed by GitHub
parent 32bd95313a
commit 1c02d73c2c
3 changed files with 4 additions and 0 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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