diff --git a/lib/cartodb/server.js b/lib/cartodb/server.js index 9d8594a0..21d34f0c 100644 --- a/lib/cartodb/server.js +++ b/lib/cartodb/server.js @@ -164,16 +164,6 @@ module.exports = function(serverOptions) { var authApi = new AuthApi(pgConnection, metadataBackend, mapStore, templateMaps); - app.findStatusCode = function(err) { - var statusCode; - if ( err.http_status ) { - statusCode = err.http_status; - } else { - statusCode = statusFromErrorMessage('' + err); - } - return statusCode; - }; - var TablesExtentApi = require('./api/tables_extent_api'); var tablesExtentApi = new TablesExtentApi(pgQueryRunner); @@ -429,7 +419,7 @@ function bootstrap(opts) { label = label || 'UNKNOWN'; - var statusCode = app.findStatusCode(err); + var statusCode = findStatusCode(err); // use console.log for statusCode != 500 ? if (statusCode >= 500) { @@ -516,6 +506,16 @@ function surrogateKeysCacheBackends(serverOptions) { return cacheBackends; } +function findStatusCode(err) { + var statusCode; + if ( err.http_status ) { + statusCode = err.http_status; + } else { + statusCode = statusFromErrorMessage('' + err); + } + return statusCode; +} + function statusFromErrorMessage(errMsg) { // Find an appropriate statusCode based on message var statusCode = 400;