Fix: boom error on invalid include

Sends a 501 `notImplemented` error when `parseInclude` can't find models
to include.
This commit is contained in:
Joey Baker 2016-09-03 18:48:03 -07:00
parent 38ccb3adf6
commit f2f613b35b

View File

@ -1,4 +1,5 @@
import { omit, identity } from 'lodash';
import { notImplemented } from 'boom';
export const parseInclude = request => {
const include = Array.isArray(request.query.include) ? request.query.include
@ -8,7 +9,7 @@ export const parseInclude = request => {
const noRequestModels = !request.models;
if (noGetDb && noRequestModels) {
return new Error('`request.getDb` or `request.models` are not defined.'
return notImplemented('`request.getDb` or `request.models` are not defined.'
+ 'Be sure to load hapi-sequelize before hapi-sequelize-crud.');
}