Ember.js: Route Recognizer - Add route name in error message when missing params

Created on 12 Nov 2018  路  5Comments  路  Source: emberjs/ember.js

As a developer when I try to transition using the controller.transitionToRoute('routeName', model) method, I get an error thrown in the console with no indication of the route name. It appears that in my case when I request a transition to 'customer', it intends to redirect into the 'customer.index' sub-route and it is missing a parameter.

It would be nice to have the route name shown in the error.

ember-metal.js:3992 Error: You must provide param customer_id to generate.
at getParam (route-recognizer.js:136)
at Array.generate.(/debug/anonymous function) (/assets/vendor.js:65944:21)
at RouteRecognizer.generate$1 [as generate] (route-recognizer.js:545)
at updateURL (router.js:1957)
at router.js:1466
at tryCatcher (rsvp.js:215)
at invokeCallback (rsvp.js:393)
at rsvp.js:457
at rsvp.js:14
at invoke (backburner.js:274)
defaultDispatch @ember-metal.js:3992
dispatchError @ember-metal.js:3973
onerrorDefault @rsvp.js:23
trigger @rsvp.js:75
(anonymous) @rsvp.js:906
invoke @backburner.js:274
flush @backburner.js:153
flush @backburner.js:345
end @backburner.js:455
run @backburner.js:539
join @backburner.js:546
run.join @ember-metal.js:4398
(anonymous) @has_element.js:18
exports.flaggedInstrument @ember-metal.js:3792
handleEvent @has_element.js:17
exports.default._emberMetal.Mixin.create._Mixin$create.handleEvent @view_support.js:177
_bubbleEvent @event_dispatcher.js:277
(anonymous) @event_dispatcher.js:211
dispatch @jquery.js:5183
elemData.handle @jquery.js:4991

"ember-cli": "~2.16.2"

Bug Routing

Most helpful comment

IMHO, bad error messages are bugs, so I'm going to go ahead and label as such...

All 5 comments

@eomeri Since the issue tracker is mostly for bugs, and we use the RFC's repo for proposed changes, this issue may get more responses as an RFC issue (not a full proposal, just a simple issue like this one but instead moved to the RFC repo).

Use RFC issues to propose a rough idea, basically a great place to test the waters

@eomeri did you post an issue on the ember-rfc's repo? https://github.com/emberjs/rfcs/issues

@pixelhandler thanks, will submit a request as soon as possible.
Thanks for your help
Erion

Totally agree that this experience sucks, sorry about that. The error message should absolutely include the route name in addition to the query param provided.

IMHO, bad error messages are bugs, so I'm going to go ahead and label as such...

Was this page helpful?
0 / 5 - 0 ratings