[DGD] Re: About runtime errors

Erwin Harte harte at is-here.com
Wed Jan 7 02:02:49 CET 2004


On Tue, Jan 06, 2004 at 09:26:40PM +0000, Robert Forshaw wrote:
[...]
> void runtime_error(string error, int caught, int ticks)
> {
> 	mixed ** trace;
> 	mixed * err, err2;
> 	trace = call_trace();
> 	err = trace[sizeof(trace) - 2];
> 	err2 = trace[sizeof(trace) - 3];
> 
> 	message("\nRuntime error in function " + err[2] +
> 		"()\nIn Program \"" + err[1] + "\" on line " + err[3] +
> 		",\nWhich was called by \"" + err2[1] + "\" via " +
> 		(err[4] ? "call_other()" : "inheritance") +
> 		"\nwithin function " +
> 		err2[2]  + "() on line " + err2[3] + ".\n");
> 
> }

You definitely want to "#include <trace.h>" and use
err[TRACE_FUNCTION] instead of that err[2], err[TRACE_PROGNAME]
instead of err[1], etc.

Your code will make a lot more sense that way and you as well as
whoever else gets to read the code later will thank you, in years to
come.

Erwin.
-- 
Erwin Harte <harte at is-here.com>
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list