use status -2 for 404s

human_status (response.js) defines code -2 as 'user error'. 404 is definitely a user error, so using that makes sense.
eventually we should change the whole status code thing with #120
This commit is contained in:
jomo
2015-07-17 10:09:34 +02:00
parent fc5ab113db
commit 607dcaf6e5
6 changed files with 15 additions and 14 deletions

View File

@@ -77,11 +77,8 @@ module.exports = function(request, response, result) {
return;
}
if (result.status === -3) {
response.writeHead(404, headers);
response.end(result.body);
} else if (result.status === -2) {
response.writeHead(422, headers);
if (result.status === -2) {
response.writeHead(result.code || 422, headers);
response.end(result.body);
} else if (result.status === -1) {
response.writeHead(500, headers);

View File

@@ -52,8 +52,9 @@ module.exports = function(req, callback) {
// check for extra paths
if (req.url.path_list.length > 2) {
callback({
status: -3,
body: "Invalid URL Path"
status: -2,
body: "Invalid Path",
code: 404
});
return;
}

View File

@@ -11,8 +11,9 @@ module.exports = function(req, callback) {
// check for extra paths
if (req.url.path_list.length > 2) {
callback({
status: -3,
body: "Invalid URL Path"
status: -2,
body: "Invalid Path",
code: 404
});
return;
}

View File

@@ -62,8 +62,9 @@ module.exports = function(req, callback) {
// check for extra paths
if (req.url.path_list.length > 3) {
callback({
status: -3,
body: "Invalid URL Path"
status: -2,
body: "Invalid Path",
code: 404
});
return;
}

View File

@@ -59,8 +59,9 @@ module.exports = function(req, callback) {
// check for extra paths
if (req.url.path_list.length > 2) {
callback({
status: -3,
body: "Invalid URL Path"
status: -2,
body: "Invalid Path",
code: 404
});
return;
}