Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad error for closure actions wrapping missing functions. #12240

Closed
rwjblue opened this issue Aug 30, 2015 · 0 comments
Closed

Bad error for closure actions wrapping missing functions. #12240

rwjblue opened this issue Aug 30, 2015 · 0 comments

Comments

@rwjblue
Copy link
Member

rwjblue commented Aug 30, 2015

When using closure actions to wrap a function in the current context, if the function that you provide is undefined you receive a very non-helpful error message at the time you invoke the closure wrapped action (i.e. this.attrs.blah()).

Example snippet:

{{#foo-bar blah=(action somethingThatIsUndefined)}}
  Click Me!
{{/foo-bar}}

Invoking blah via this.attrs.blah() throws the following error:

Cannot read property 'apply' of undefined at Object.closureAction [as blah] (http://builds.emberjs.com/canary/ember.debug.js:22364:22)
    at click (necodu.js:20:16)
    at _emberRuntimeSystemObject.default.extend.trigger (http://builds.emberjs.com/canary/ember.debug.js:43201:23)
    at superWrapper [as trigger] (http://builds.emberjs.com/canary/ember.debug.js:21493:22)
    at Object._emberMetalMerge.default.handleEvent (http://builds.emberjs.com/canary/ember.debug.js:44108:21)

Demo: http://rwjblue.jsbin.com/necodu/edit?html,js,output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant