gmac / backbone.epoxy

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

Better error message when Epoxy.View.applyBindings() fails #11

Closed jturkel closed 11 years ago

jturkel commented 11 years ago

Errors thrown from applyBindings don't currently return information on why the binding failed which makes it hard to track down errors. For example the current error messages look something like this:

Error parsing bindings: toggle: editorClosed, classes:{markedForDelete:marked_for_delete} 

It looks like the exception caught in bindElementToView has the necessary information (in my case marked_for_delete was not defined). I'd love to see an error message like this:

Error parsing bindings: "toggle: editorClosed, classes:{markedForDelete:marked_for_delete}":  marked_for_delete is not defined
gmac commented 11 years ago

Very fair point. Marking as an enhancement to address.

gmac commented 11 years ago

Just committed an enhancement in v0.12.4 that appends the original error message onto Epoxy's specific error. Encountering an attributes parsing error should now produce:

Uncaught Error parsing bindings: "text:name,toggle:badAttrRef"
>> ReferenceError: badAttrRef is not defined