This commit is contained in:
Raul Ochoa 2015-09-16 02:49:18 +02:00
parent 62f428f434
commit 66f94d9452
2 changed files with 4 additions and 3 deletions

View File

@ -515,6 +515,7 @@ function findStatusCode(err) {
}
return statusCode;
}
module.exports.findStatusCode = findStatusCode;
function statusFromErrorMessage(errMsg) {
// Find an appropriate statusCode based on message

View File

@ -41,16 +41,16 @@ describe('windshaft', function() {
});
it('different formats for postgis plugin error returns 400 as status code', function() {
var ws = cartodbServer(serverOptions);
var expectedStatusCode = 400;
assert.equal(
ws.findStatusCode("Postgis Plugin: ERROR: column \"missing\" does not exist\n"),
cartodbServer.findStatusCode("Postgis Plugin: ERROR: column \"missing\" does not exist\n"),
expectedStatusCode,
"Error status code for single line does not match"
);
assert.equal(
ws.findStatusCode("Postgis Plugin: PSQL error:\nERROR: column \"missing\" does not exist\n"),
cartodbServer.findStatusCode("Postgis Plugin: PSQL error:\nERROR: column \"missing\" does not exist\n"),
expectedStatusCode,
"Error status code for multiline/PSQL does not match"
);