From 41a4a9f4fb461c1a7562e2c4e6a4c53805456a39 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Tue, 19 Jan 2021 15:25:37 +0000 Subject: [PATCH] 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) --- ui/packages/consul-ui/app/helpers/href-to.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ui/packages/consul-ui/app/helpers/href-to.js b/ui/packages/consul-ui/app/helpers/href-to.js index bd05149349..9a695ee8e0 100644 --- a/ui/packages/consul-ui/app/helpers/href-to.js +++ b/ui/packages/consul-ui/app/helpers/href-to.js @@ -42,7 +42,14 @@ export default class HrefToHelper extends Helper { @service('router') router; 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')