exceptions vs error codes

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 10 10:29:48 PDT 2016


On Sunday, 10 July 2016 at 17:19:31 UTC, phant0m wrote:
> Personally, I don't understand the need for exceptions at all. 
> Usually, only a calling context can fix the error and continue 
> execution of the program. If exception caught by a top level 
> handler, all it can do is just a crash. Moreover, with 
> exceptions, you need to wrap every piece of code with ugly 
> "try/catch".

No, not if you use RAII.

In a web server it is quite useful to just let uncaught 
exceptions result in a http status and unwind transactions 
automatically without having to put all kinds of error checks in 
the core logic of the program.



More information about the Digitalmars-d mailing list