Peter Alexander:

(I assume that nothrow isn't meant to be there?)

In D nothrow functions can throw errors.


You could do something like this:

void foo() @nogc
{
    static err = new Error();
    if (badthing)
    {
        err.setError("badthing happened");
        throw err;
    }
}

To be mutable err also needs to be __gshared.

Bye,
bearophile

Reply via email to