MXS-1300: Improve MaxCtrl HTTP error messages

The messages now show where the request failed and what was
requested. This should help resolve both develper and end-user problems.

Also fixed the missing logging of the output string in the `parse`
callback of the main function and cleaned up the POSTed server body.
This commit is contained in:
Markus Mäkelä
2017-08-04 14:03:55 +03:00
parent 8f7be8a4f3
commit db531fb2e2
3 changed files with 15 additions and 5 deletions

View File

@ -195,9 +195,9 @@ module.exports = function() {
}
}, function(err) {
if (err.response && err.response.body) {
return error('Server responded with status code ' + err.statusCode + ' to `' + err.response.request.method +' ' + resource + '`:' + JSON.stringify(err.response.body, null, 4))
return error('Server at '+ err.response.request.uri.host +' responded with status code ' + err.statusCode + ' to `' + err.response.request.method +' ' + resource + '`:' + JSON.stringify(err.response.body, null, 4))
} else if (err.statusCode) {
return error('Server responded with status code ' + err.statusCode + ' to `' + err.response.request.method +' ' + resource + '`')
return error('Server at '+ err.response.request.uri.host +' responded with status code ' + err.statusCode + ' to `' + err.response.request.method +' ' + resource + '`')
} else if (err.error) {
return error(JSON.stringify(err.error, null, 4))
} else {