Comparing version 0.1.0-beta-5 to 0.1.0-beta-6
@@ -305,11 +305,4 @@ "use strict"; | ||
_handleError: function Request_handleError(response) { | ||
var Controller, | ||
errorRoute = router.getErrorRoute(), | ||
errorController = '@{controllersPath}/' + errorRoute.shift(), | ||
errorAction = errorRoute.shift(); | ||
if (response instanceof Error && !this.isERROR && di.exists(di.normalizePath(errorController) + '.js')) { | ||
if (response instanceof Error && !this.isERROR && !!router.getErrorRoute()) { | ||
if (response.code) { | ||
@@ -320,24 +313,4 @@ this.statusCode = response.code; | ||
} | ||
try { | ||
Controller = di.load(errorController); | ||
errorController = new Controller(); | ||
if (errorController.has('action_' + errorAction)) { | ||
response = errorController.get('action_' + errorAction).call(errorController, response); | ||
if (response.trace) { | ||
this._render(response.trace); | ||
} else if (response.stack) { | ||
this._render(response.stack); | ||
} else { | ||
this._render(response); | ||
} | ||
} else { | ||
throw new error.HttpError(500, {errorAction: errorAction}, "No error action defined at error controller"); | ||
} | ||
} catch (e) { | ||
this.isERROR = true; | ||
throw new error.HttpError(500, {}, "Error on executing error action", e); | ||
} | ||
this.isERROR = true; | ||
return this._resolveRoute([router.getErrorRoute(), response]).then(null, this._handleError); | ||
} else if (response.trace) { | ||
@@ -344,0 +317,0 @@ this.addHeader('Content-Type', 'text/plain'); |
@@ -30,8 +30,4 @@ "use strict"; | ||
this.config = core.extend({ | ||
errorRoute: "error/index" | ||
errorRoute: false | ||
}, config); | ||
if (!Type.assert(Type.STRING, this.config.errorRoute)) { | ||
throw new error.DataError(this.config, 'Router.construct: errorRoute must be string type'); | ||
} | ||
}, | ||
@@ -48,3 +44,3 @@ /** | ||
getErrorRoute: function Router_getErrorRoute() { | ||
return this.config.errorRoute.split('/').splice(0, 2); | ||
return this.config.errorRoute; | ||
}, | ||
@@ -51,0 +47,0 @@ /** |
@@ -5,3 +5,3 @@ { | ||
"description": "Powerful lightweight mvc framework for nodejs", | ||
"version": "0.1.0-beta-5", | ||
"version": "0.1.0-beta-6", | ||
"dependencies" : { | ||
@@ -8,0 +8,0 @@ "mongoose": "3.8.x", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103580
3294