March 15, 2020 How catch any error in Dlang like Python try-except? | ||||
---|---|---|---|---|
| ||||
How catch any error in Dlang like Python tray-except? It is very useful when making tests. But only who came from interpreted languages can understand. Exemple: import std; void main() { try { writelnX("try function that not exist"); } catch (Throwable e) { writeln("Error: %s".format(e.msg)); } } |
March 15, 2020 Re: How catch any error in Dlang like Python try-except? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marcone | On Sunday, 15 March 2020 at 02:11:21 UTC, Marcone wrote:
> It is very useful when making tests. But only who came from interpreted languages can understand.
The compiler catches all compile errors. It is impossible to even run a program if there is even a single compile error. Thus they cannot be caught.
|
Copyright © 1999-2021 by the D Language Foundation