Error and Exception chaining

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 12 14:13:59 PST 2016


On 12/12/2016 02:08 PM, Yuxuan Shui wrote:
 > Thanks a lot for the explanation!
 >
 > On Monday, 12 December 2016 at 22:01:54 UTC, Ali Çehreli wrote:
 >> (Note: Looks like there is a bug regarding Error.bypassedException
 >> member. Would others please confirm.)
 >>
 >> On 12/12/2016 01:15 PM, Yuxuan Shui wrote:
 >> > [...]
 >> that Error
 >> > [...]
 >> vague, and I'm
 >> > [...]
 >>
 >> You're referring to "[Errors] bypass the normal chaining mechanism,
 >> such that the chain can only be caught by catching the first Error."
 >> What it means is that an Error cannot be a collateral of an Exception,
 >> hiding in its chain. So, when there is an Error that would otherwise
 >> be a collateral of an Exception, you cannot catch the original
 >> Exception. What is more importantly in-flight at that time is the Error.
 >>
 >
 > But chaining Error to Error works just like chaining Exception to
 > Exception?

Currently yes. Now this line in my versatile :o) program:

             if (n >= errorIndex) {

Two Errors are chained:

Caught
TestError: 3
  TestError: 4

However, there is the following ongoing thread claiming that it was a 
wrong decision:

   http://forum.dlang.org/post/o2n347$2i1g$1@digitalmars.com

 >> But bypassedException member of Error is always null. Bug?
 >
 > Did I just randomly found a bug?

 From what I could graps from that much of documentation, yes, it seems 
to be a bug.

Ali



More information about the Digitalmars-d-learn mailing list