Summary: Catch multiple exception types with single catch block
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD

--- Comment #0 from yebblies <> 2012-02-19 18:47:51 EST ---
In some cases, multiple exceptions require the exact same handling code in a
catch block, but are not the only children of a common base class.

class MyExceptionA : Exception {}
class MyExceptionB : Exception {}
class MyExceptionC : Exception {}

void main()
    catch (e : MyExceptionA, MyExceptionB)
        // handle A and B
    catch (MyExceptionC e)
        // handle C a different way

This avoid the current messy solutions such as duplicating the bodies, using
goto (does this even work?), moving the code to a function, or catching the
base class and using typeinfo to choose.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to