Custom default exception handler?

Jacob Carlborg doob at me.com
Tue Feb 11 11:31:51 PST 2014


On 2014-02-11 06:09, Nick Sabalausky wrote:

> I don't strictly *need* to. But if you're curious, here's the story:
>
> I like to use a little custom exception (Fail) in shell script-like
> stuff to bail out and exit with a given error message in an
> exception-safe way. This is for expected failure conditions, not
> internal errors (so for example: "copy src.txt" -> "Error, no
> destination given!" or "File src.txt doesn't exist!", etc), so the stack
> trace is unnecessary noise and omitted. Only the message is printed,
> maybe with a common prefix like "mytool: ERROR: ...".

Perhaps you can do something with core.runtime.Runtime.traceHandler.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list