No need to expose findStatusCode at app level

This commit is contained in:
Raul Ochoa 2015-09-16 01:44:30 +02:00
parent ad2ebc11dd
commit 713ad03c3b

View File

@ -164,16 +164,6 @@ module.exports = function(serverOptions) {
var authApi = new AuthApi(pgConnection, metadataBackend, mapStore, templateMaps); 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 = require('./api/tables_extent_api');
var tablesExtentApi = new TablesExtentApi(pgQueryRunner); var tablesExtentApi = new TablesExtentApi(pgQueryRunner);
@ -429,7 +419,7 @@ function bootstrap(opts) {
label = label || 'UNKNOWN'; label = label || 'UNKNOWN';
var statusCode = app.findStatusCode(err); var statusCode = findStatusCode(err);
// use console.log for statusCode != 500 ? // use console.log for statusCode != 500 ?
if (statusCode >= 500) { if (statusCode >= 500) {
@ -516,6 +506,16 @@ function surrogateKeysCacheBackends(serverOptions) {
return cacheBackends; return cacheBackends;
} }
function findStatusCode(err) {
var statusCode;
if ( err.http_status ) {
statusCode = err.http_status;
} else {
statusCode = statusFromErrorMessage('' + err);
}
return statusCode;
}
function statusFromErrorMessage(errMsg) { function statusFromErrorMessage(errMsg) {
// Find an appropriate statusCode based on message // Find an appropriate statusCode based on message
var statusCode = 400; var statusCode = 400;