ui: Improves the 'you must provide ... to `generate`' error from href-to (#9514)

This originally comes form the ember-href-to helper and is one of those
errors that when I see it I think ... hmmm

This gives a little bit more of a clue as to what is wrong by logging
the route name you asked for plus the params you passed to it so you:

1. Have more help finding the href-to that is problematic in the
template/component
2. Can see all the parameters you passed (including a potential null
parameter for the thing you are missing)
pull/9674/head
John Cowen 4 years ago committed by GitHub
parent ee368e9a00
commit 41a4a9f4fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -42,7 +42,14 @@ export default class HrefToHelper extends Helper {
@service('router') router; @service('router') router;
compute(params, hash) { compute(params, hash) {
return hrefTo(this, this.router, params, hash); let href;
try {
href = hrefTo(this, this.router, params, hash);
} catch (e) {
e.message = `${e.message} For "${params[0]}:${JSON.stringify(params.slice(1))}"`;
throw e;
}
return href;
} }
@observes('router.currentURL') @observes('router.currentURL')

Loading…
Cancel
Save