Exception isn't thrown as expected

Alexandr Druzhinin drug2004 at bk.ru
Sun Jun 2 20:23:05 PDT 2013


31.05.2013 8:56, Alexandr Druzhinin пишет:
> Hello
> I have code like this:
>
> class SomeClass {
> ubyte[] data_;
>
> ...
>
>      auto getObjectType() const {
>          if(data_ is null) {
>              writeln("throwing");
>              throw new Exception("Here the exception should be thrown!");
>          }
>          KeyHeaderHelper value_header;
>          value_header.ptr_ = cast(ubyte*) data_.ptr;
>          return value_header.object_type;
>      }
> }
>
> When data_ is null the application just prints "throwing" and hangs up
> without an exception throwing. I don't know how to handle this. May be I
> did something wrong? If so then what?
can't reduce code enough, but I found that after calling 
std.concurrency.spawn() template - exceptions stop throwing, but if I 
add little delay in beginning of spawned thread about 100 ms - it'd 
works again and exceptions would be thrown again... :(


More information about the Digitalmars-d-learn mailing list