From b91359055f632d8a76171a2c99f08fb4f38f11c4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sat, 1 Oct 2016 09:48:49 +0200 Subject: Server: add information why a friend request failed (status code) --- server/models/request.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'server/models/request.js') diff --git a/server/models/request.js b/server/models/request.js index 4e510e18a..b36b4f613 100644 --- a/server/models/request.js +++ b/server/models/request.js @@ -96,7 +96,14 @@ function makeRequest (toPod, requestsToMake, callback) { // The function fire some useful callbacks requests.makeSecureRequest(params, function (err, res) { if (err || (res.statusCode !== 200 && res.statusCode !== 201 && res.statusCode !== 204)) { - logger.error('Error sending secure request to %s pod.', toPod.url, { error: err || new Error('Status code not 20x') }) + logger.error( + 'Error sending secure request to %s pod.', + toPod.url, + { + error: err || new Error('Status code not 20x'), + statusCode: res.statusCode + } + ) return callback(false) } @@ -160,12 +167,6 @@ function makeRequests () { } makeRequest(toPod, requestToMake.datas, function (success) { - if (err) { - logger.error('Errors when sent request to %s.', toPod.url, { error: err }) - // Do not stop the process just for one error - return callbackEach() - } - if (success === true) { logger.debug('Removing requests for %s pod.', toPodId, { requestsIds: requestToMake.ids }) -- cgit v1.2.3