gmac / backbone.epoxy

Declarative data binding and computed models for Backbone
http://epoxyjs.org
MIT License
615 stars 89 forks source link

Throw error when unknown binding handler is found #58

Closed Prinzhorn closed 10 years ago

Prinzhorn commented 10 years ago

Imagine using the text binding and having a typo in the bindings like tetx. You may spend an unnecessary amount of time trying to debug this, because epoxy silently ignores unknown bindings.

I guess there should be an else with a throw at this line https://github.com/gmac/backbone.epoxy/blob/8cef8fff1825c59f96a2e1f13fc6b86f71f9a0f0/backbone.epoxy.js#L1215 , do you agree? Is this even the right part of the code? I was just searching through it real quick.

I can create a pull request if you want to.

gmac commented 10 years ago

The reason this hasn't thrown errors in the past is because non-handler binding params ("events", "optionsDefault", etc) would be caught by this error checking and throw exceptions. However, this issue has come up several times now, so let's finally do something about it. I've added validation against allowed param attributes as well... now if there's no handler and no allowed attribute with the given name, then an exception should be raised. See f86ceae.

Prinzhorn commented 10 years ago

Thanks!