Skip to content

added error for non-array policy declaration#46

Open
weyj4 wants to merge 2 commits intomasterfrom
policy-array
Open

added error for non-array policy declaration#46
weyj4 wants to merge 2 commits intomasterfrom
policy-array

Conversation

@weyj4
Copy link
Copy Markdown
Member

@weyj4 weyj4 commented Apr 6, 2016

No description provided.

Comment thread lib/util.js
const prerequisites = lib.Util.getRoutePrerequisites(policies, route)
if (!_.isArray(prerequisites)) {
app.log.error('trailpack-router: policy', prerequisites, 'must be an array.')
}
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

weyj4 commented Apr 19, 2016

@tjwebb if this looks good go ahead and merge

@jaumard
Copy link
Copy Markdown
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