(picture)

October 14, 2003

Throw

Joel Spolsky says exceptions "are significantly worse than goto's... A better alternative is to have your functions return error values when things go wrong". Ned Batchelder and others disagree.

I'm with Ned (approximately). Con: JavaScript doesn't have "first chance exception" handling, which is a royal pain. Pro: "finally" is a wonderful thing. Mu: If there's an interface demarcation which uses result codes, that's fine. But neither model is really great for asynchronous programming.