emberjs / emberjs/ember.js

Error substate does not receive model hook rejection reason unless it is an Error object

Open
#15,842 4 comments 0 reactions 0 assignees View on GitHub
bug Has Reproduction Routing
Dominant language
TypeScript
Stars
22.6k
Forks
4.2k
Avg merge
3d 12h
Merged PRs (30d)
15

Description

If you return `Ember.RSVP.reject('whatever')` from a model hook, the error substate will not recieve the reason as the model as indicated in the [guides](https://guides.emberjs.com/v2.16.0/routing/loading-and-error-substates/#toc_code-error-code-substates):

> The "reason" for the error (i.e. the exception thrown or the promise reject value) will be passed to that error state as its model.

See https://ember-twiddle.com/566eb0e180a20a9f96a22578abf614d2?fileTreeShown=false&numColumns=2&openFiles=routes.application.js%2Ctemplates.application-error.hbs

If I instead return `Ember.RSVP.reject(new Error('whatever'))` it works as expected.

I think this is either a bug or a case where the docs need a bit more work.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.