Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added error for non-array policy declaration #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

weyj4
Copy link
Member

@weyj4 weyj4 commented Apr 6, 2016

No description provided.

@@ -30,6 +30,9 @@ module.exports = {
decorateRouteWithPrerequisites (app, route) {
const policies = app.config.policies
const prerequisites = lib.Util.getRoutePrerequisites(policies, route)
if (!_.isArray(prerequisites)) {
app.log.error('trailpack-router: policy', prerequisites, 'must be an array.')
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should return here, right? Otherwise, the app will still try to use the wrong value. I think we want to ignore this policy config, and throw the error

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weyj4 if you can add in this fix, I can merge. Looks good otherwise.

@weyj4
Copy link
Member Author

weyj4 commented Apr 19, 2016

@tjwebb if this looks good go ahead and merge

@jaumard
Copy link
Contributor

jaumard commented May 21, 2016

Maybe it's a string we can just do [prerequisites], but if it's not an array or string do like you did here.
Allowed string can be useful to have 'TestController': 'TestPolicy.test',...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants