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

Either fail gracefully or emit useful error message .on("unknownEvent") #9

Closed
syntagmatic opened this issue May 13, 2016 · 1 comment

Comments

@syntagmatic
Copy link

Using .on to listen to an event that doesn't exist triggers an error on

if (t && !types.hasOwnProperty(t)) throw new Error;

Possible solutions:

  • parseTypenames filters out undefined event types
  • error alerts the full event name that couldn't be matched to an event
@mbostock
Copy link
Member

I’m somewhat averse to error messages because the error should be pretty obvious from the stack trace, and debuggers are far more effective at debugging than reading error messages. But, okay.

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

No branches or pull requests

2 participants