Rethrow an exception like in C++?

Andrej Mitrovic andrej.mitrovich at gmail.com
Thu Mar 7 17:56:33 PST 2013


On 3/8/13, Rob T <alanb at ucora.com> wrote:
> In C++, I rethrow an exception without explicitly catching it
>
> catch(...)
> {
>     throw;
> }
>
> Anyone know of a way to do the same thing in D?
>
> catch
> {
>     // rethrow?
>
> }

The only way:

try { }
catch (Exception ex) { throw ex; }

Or use Error or Throwable if really necessary, however you shouldn't
really catch those in normal code.


More information about the Digitalmars-d-learn mailing list