canjs / can-stache-bindings

Binding helpers for CanJS template engines
https://canjs.com/doc/can-stache-bindings.html
MIT License
8 stars 8 forks source link

Make the “Unable to bind” error message more useful #542

Closed chasenlehara closed 5 years ago

chasenlehara commented 5 years ago

Here’s an example project: https://codepen.io/bitovi/pen/XWrOoOK?editors=0011

This error is thrown:

Uncaught Error: can-event-queue: Unable to bind complete

This error is thrown from can-event-queue (so maybe it should be fixed there), but I’m filing the issue here because maybe can-stache-bindings should catch the error and provide more info.

The actual problem with the above CodePen is that the array contains plain objects and can-event-queue can’t listen for their complete property to change.

Ideally, an improved error message would:

1) Make it more clear that complete is a property on an object 2) Make it clear which object it’s trying to bind to 3) Explain why it can’t bind to it (it’s a plain object) 4) Offer a suggestion or a link to docs to explain how to fix it

cherifGsoul commented 5 years ago

What link can be suggested for 4th item in the list above? cc @phillipskevin