1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-17 20:32:41 +01:00

Return a HTTP 500 instead of a HTTP 400 if an internal error occurs in the Aphlict server

Summary: Ref T5651. Only throw a HTTP 400 if the data is invalid (i.e. the request is bad). If something bad happens when trying to transmit the notification, throw a HTTP 500 instead.

Test Plan: Eye-ball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5651

Differential Revision: https://secure.phabricator.com/D9968
This commit is contained in:
Joshua Spence 2014-07-18 09:20:00 +10:00
parent 41a8837f78
commit f2fee5a84e

View file

@ -177,9 +177,18 @@ var receive_server = http.createServer(function(request, response) {
debug.log('notification: ' + JSON.stringify(msg)); debug.log('notification: ' + JSON.stringify(msg));
++messages_in; ++messages_in;
transmit(msg);
try {
transmit(msg);
response.writeHead(200, {'Content-Type': 'text/plain'}); response.writeHead(200, {'Content-Type': 'text/plain'});
} catch (err) {
debug.log(
'<%s> Internal Server Error! %s',
request.socket.remoteAddress,
err);
response.statusCode = 500;
response.write('500 Internal Server Error\n');
}
} catch (err) { } catch (err) {
debug.log( debug.log(
'<%s> Bad Request! %s', '<%s> Bad Request! %s',