[Issue 8140] New: allow to catch exceptions by implemented interface

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 24 05:20:27 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8140

           Summary: allow to catch exceptions by implemented interface
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: druntime
        AssignedTo: nobody at puremagic.com
        ReportedBy: luka8088 at owave.net


--- Comment #0 from luka8088 <luka8088 at owave.net> 2012-05-24 05:22:09 PDT ---
Now we can only catch by class that is derived from Throwable. This prevents
logical generic *grouping* and catching by *group*. As discussed in #d on
freenode irc from 24-05-2012 13:20:00 to 24-05-2012 13:56:00.

For example:

// assume that IThrowable is in druntime

interface IMyException1: IThrowable {}
interface IMyException2: IThrowable {}
interface IMyException3: IThrowable {}

class MyException1: Exception, IMyException1 {}
class MyException2: Exception, IMyException1, IMyException2 {}
class MyException3: Exception, IMyException1 ,IMyException3 {}
class MyException4: Exception, IMyException3 {}

try {

  throw new MyException2();

} catch (IMyException3) {

  // catches MyException3 or MyException4

}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list