As far as I know, JavaScript has no error typing.
In C # and Java, it is possible to do things like:
try {
/* .. snip .. */
} catch (FooException foo) {
/* .. snip .. */
} catch (BarException bar) {
/* .. snip .. */
} catch (NotEnoughCoffeException nec) {
/* .. snip .. */
} /* etc. */
And so we give a different error handling for each type of exception.
In javascript, the best we have is:
try {
/* .. snip .. */
} catch (couldBeAnything) {
/* dize-me com quem erras e te direi quem és */
}
And what's worse, you do not have to duck typing to help at that time.
When we have some JavaScript code that can fail in many different ways ... Is there any design pattern, any methodology to identify what happened? Is there any way to insert an error code in the exception, for example?