Thread overview | |||||
---|---|---|---|---|---|
|
May 29, 2005 AssertError or AssertException? | ||||
---|---|---|---|---|
| ||||
/dbc.html states: "an assert in function bodies works by throwing an AssertException, which can be caught and handled." /expression.html#AssertExpression says: "Asserts evaluate the expression. If the result is false, an AssertError is thrown." Which statement is correct? How to catch an assertion exception? |
May 29, 2005 Re: AssertError or AssertException? | ||||
---|---|---|---|---|
| ||||
Posted in reply to zwang | "zwang" <nehzgnaw@gmail.com> wrote in message news:d7co51$2p14$1@digitaldaemon.com... > /dbc.html states: > "an assert in function bodies works by throwing an AssertException, which > can be caught and handled." > > /expression.html#AssertExpression says: > "Asserts evaluate the expression. If the result is false, an AssertError > is thrown." > > Which statement is correct? > How to catch an assertion exception? dmd/src/phobos/std/asserterror.d has a definition for an AssertError class. So you'd use catch(AssertError ae) { } to catch an AssertError. This also means that dbc.html has a typo. |
May 29, 2005 Re: AssertError or AssertException? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | Jarrett Billingsley wrote:
> "zwang" <nehzgnaw@gmail.com> wrote in message news:d7co51$2p14$1@digitaldaemon.com...
>
>>/dbc.html states:
>>"an assert in function bodies works by throwing an AssertException, which can be caught and handled."
>>
>>/expression.html#AssertExpression says:
>>"Asserts evaluate the expression. If the result is false, an AssertError is thrown."
>>
>>Which statement is correct?
>>How to catch an assertion exception?
>
>
> dmd/src/phobos/std/asserterror.d has a definition for an AssertError class. So you'd use
>
> catch(AssertError ae)
> {
>
> }
>
> to catch an AssertError.
>
> This also means that dbc.html has a typo.
>
>
Thanks!
|
Copyright © 1999-2021 by the D Language Foundation