Skip to content

Commit

Permalink
Merge pull request #16199 from emberjs/chancancode-patch-1
Browse files Browse the repository at this point in the history
[BUGFIX beta] Mention "computed properties" in the assertion message
  • Loading branch information
rwjblue authored and chancancode committed Feb 3, 2018
1 parent adcae3a commit 691259c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
30 changes: 15 additions & 15 deletions packages/ember-metal/lib/properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,22 @@ if (EMBER_METAL_ES5_GETTERS) {
// development to aid in development asertions. Production builds of
// ember strip this entire branch out.
let messageFor = function(obj, keyName, property, value) {
return `You attempted to access the \`${keyName}.${String(property)}\` property ` +
`(of ${obj}). Due to certain internal implementation details of Ember, ` +
`the \`${keyName}\` property previously contained an internal "descriptor" ` +
`object (a private API), therefore \`${keyName}.${String(property)}\` would have ` +
`been \`${String(value).replace(/\n/g, ' ')}\`. This internal implementation ` +
`detail was never intended to be a public (or even intimate) API.\n\n` +
`This internal implementation detail has now changed and the (still private) ` +
`"descriptor" object has been relocated to the object's "meta" (also a ` +
`private API). Soon, accessing \`${keyName}\` on this object will ` +
`return the computed value (see RFC #281 for more details).\n\n` +
return `You attempted to access \`${keyName}.${String(property)}\` ` +
`(on \`${obj}\`), but \`${keyName}\` is a computed property.\n\n` +
`Due to certain internal implementation details of Ember, the ` +
`\`${keyName}\` property previously contained a private "descriptor" ` +
`object, therefore \`${keyName}.${String(property)}\` would have been ` +
`\`${String(value).replace(/\n/g, ' ')}\`.\n\n` +
`This implementation detail has now changed and the "descriptor" ` +
`object is no longer present at this location. Soon, accessing ` +
`\`${keyName}\` on this object will return the computed property's ` +
`current value (see RFC #281 for more details).\n\n` +
`If you are seeing this error, you are likely using an addon that ` +
`relies on this now-defunct private implementation detail. If you can, ` +
`find out which addon is doing this from the stack trace below and ` +
`report this bug to the addon authors. If you feel stuck, the Ember ` +
`Community Slack (https://ember-community-slackin.herokuapp.com/) ` +
`may be able to offer some help.\n\n` +
`relies on this now-defunct private implementation detail. If you ` +
`can, identify the addon from the stack trace below and report this ` +
`bug to the addon authors. If you feel stuck, the Ember Community ` +
`Slack (https://ember-community-slackin.herokuapp.com/) may be able ` +
`to offer some help.\n\n` +
`If you are an addon author and need help transitioning your code, ` +
`please get in touch in the #dev-ember channel in the Ember Community ` +
`Slack.`;
Expand Down
4 changes: 2 additions & 2 deletions packages/ember-metal/tests/computed_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ if (EMBER_METAL_ES5_GETTERS) {
return 'computed ' + key;
}));

expectAssertion(() => obj.foo.isDescriptor, /You attempted to access the `foo\.isDescriptor` property \(of obj\)\./);
expectAssertion(() => obj.foo.get(), /You attempted to access the `foo\.get` property \(of obj\)\./);
expectAssertion(() => obj.foo.isDescriptor, /You attempted to access `foo\.isDescriptor` \(on `obj`\)/);
expectAssertion(() => obj.foo.get(), /You attempted to access `foo\.get` \(on `obj`\)/);
assert.strictEqual(count, 0, 'should not have invoked computed property');
});
}
Expand Down

0 comments on commit 691259c

Please sign in to comment.