Le 21/02/2012 11:40, Vincent a écrit :
On Saturday, 18 February 2012 at 18:52:05 UTC, Andrei Alexandrescu wrote:
From experience I humbly submit that catching by type is most of the
time useless.

Completely disagree. Types allow to control place for "catch". Say, some
deeply nested function catches its own exceptions, while outer function
catches the rest - exceptions higher in hierarchy. But to have benefit
you have to create exceptions hierarchy - this is the main point.

Well, we must consider that the only thing we have to select Exception if the type. But do we really want to catch on type, or do we use the type because we lack of a better mecanism select exceptions we want to handle ?

A new type should be added only if it make sense to provide additionnal informatiosn about the issue faced. The pertienent information will depend on the issue, so some issue will require new types of Exception.

Plus, sometime, things doesn't fit in a Tree shape.

But creating Exception just to catch specifically thoses don't make a lot of sense. This is why several person proposed ways to add a way to select more precisely what we want to catch.

Reply via email to