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:
parent
41a8837f78
commit
f2fee5a84e
1 changed files with 11 additions and 2 deletions
|
@ -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',
|
||||||
|
|
Loading…
Reference in a new issue