gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gforth] Deactivate the backtrace message?


From: Marcos Cruz
Subject: Re: [gforth] Deactivate the backtrace message?
Date: Wed, 16 Dec 2015 20:51:52 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

En/Je/On 2015-12-16 18:58, Anton Ertl escribió / skribis / wrote :

> ' noop is dobacktrace

Thanks. Perfect.

> The idea is that your program is for either
> 2) a less sophisticated user who may be confused by the backtrace.

Maybe the user is highly sophisticated, but has no idea of Forth.  And
anyway this is a command line tool intended to be used in tool chains,
concatenated commands, Makefile...  (so `quit` or `bye` are not an
option, because the Forth system must exit with an error).  Beside, all
possible errors are caused by checking wrong parameters, so the
backtrace is useless in this case.

> In that case, you should not throw to the system, but catch such
> throws yourself and give the user something they understand;

As errors are simple, clear and unrecoverable, and there's no need to
show any variable info, the hardcoded message of `abort"` is enough in
this case.

But what about preventing the offending line from being shown? See:

----
$ mkepr -s 2048 -o /tmp/eprom512.epr documents/*.txt

in file included from *OS command line*:-1
/usr/local/bin/mkepr:675: Wrong size for the card type.
>>>mkepr<<< bye
$
----

Is there any way to show only the `abort"` message? This would be ideal:

----
$ mkepr -s 2048 -o /tmp/eprom512.epr documents/*.txt
Wrong size for the card type.
$
----

Even if I catch the throws, I need to do `abort` at the end, in order to
return an error to the shell. So the "in file included..." message would
be shown anyway.

-- 
Marcos Cruz
http://programandala.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]