tired of not having exit(code), ER proposed

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 28 19:30:05 PDT 2014


Hello.

i'm really got tired of writing try/catch boilerplate in main() just to
be able to exit from some inner function, setup exitcode and suppress
stack trace. so i wrote this small ER:
https://issues.dlang.org/show_bug.cgi?id=13554

it adds ExitError to core.exception. when runtime catches it, runtime
will set error code and exit silently instead of printing error message
and stack trace. so now you can avoid wrapping your main in boilerplate
try/catch and easily exit from anywhere just by throwing ExitError.

sure you still can catch ExitError in your main(), do some cleanup and
rethrow it if you want to.

it's simple, it's easy, it's handy.

happy hacking.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140929/b1ec9343/attachment.sig>


More information about the Digitalmars-d mailing list