This isn't the best solution for whatever is happening to you.<p>If you don't know what method is going to be called on your class, there's something wrong with your code. I'm assuming this either happens when A) your input isn't validated/sanitized (generic routing allows <i>any</i> method on your class to be called) or B) you're coding sloppily.<p>In the case of A, you need to validate your routing. If a user calls a route that doesn't exist, they should get a 404. This can become a security issue if you don't do it.<p>In the case of B, JS already tells you that the method isn't defined. Or, if you're using a good IDE, JSLint, TypeScript, or Flow, you should see a warning before you run your code.