Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ module.exports = {
decorateRouteWithPrerequisites (app, route) {
const policies = app.config.policies
const prerequisites = lib.Util.getRoutePrerequisites(policies, route)
if (!_.isArray(prerequisites)) {
throw new TypeError(['trailpack-router: policy', prerequisites, 'must be an array.'].join(' '))
}

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.


return _.defaultsDeep({ }, route, {
config: {
Expand Down