Better message when a object param is not found.

This commit is contained in:
Julien Fontanet 2015-05-28 11:40:56 +02:00
parent 4d3dfa1dca
commit 35bf7dc484
2 changed files with 15 additions and 19 deletions

View File

@ -147,7 +147,6 @@ function resolveParams (method, params) {
const isAdmin = this.user.hasPermission('admin')
const promises = []
try {
forEach(resolve, ([param, types], key) => {
const id = params[param]
if (id === undefined) {
@ -166,9 +165,6 @@ function resolveParams (method, params) {
promises.push(checkAuthorization.call(this, userId, object))
}
})
} catch (error) {
throw new NoSuchObject()
}
return Bluebird.all(promises).return(params)
}

View File

@ -414,7 +414,7 @@ export default class Xo extends EventEmitter {
const obj = all[key] || byRef[key]
if (!obj) {
throw new NoSuchObject(key)
throw new NoSuchObject(key, type)
}
if (type != null && (