[dev-context] Error handling in modules?

Hans Hagen pragma at wxs.nl
Sun Oct 2 22:29:54 CEST 2005


Taco Hoekwater wrote:

> Brooks Moses wrote:
>
>> Hi!
>>
>> In LaTeX, there is a \PackageError macro for reporting errors from 
>> packages -- basically, it's just a standard way of creating a 
>> TeX-like error message, with a user-defined text, and the standard 
>> "?" prompt waiting for user intervention.
>>
>> Is there a similarly standard way for producing error messages in 
>> ConTeXt modules?
>
>
> The normal approach in ConTeXt is to use the messaging system for a
> nice looking warning, then call the \wait macro if the user's immediate
> attention is really, really needed. No calls on \errmessage and \errhelp
> are made except in third-party bits.
>
> I used to do stuf like this:
>
> \startmessages all
>    library: brooks
>    title: brooks
>    1: -- (warning)
>    2: -- ! (error)
>    3: -- ! (fatal)
> \stopmessages
>
> \def\warning#1{\showmessage{brooks}{1}{#1}}
> \def\error#1{\showmessage{brooks}{2}{#1}\wait }
> \def\fatal#1{\showmessage{brooks}{3}{#1}\batchmode \wait }
>
indeed, although using \error \warning and \fatal as command name may lead to future errors when i decide to defien them in the kernel -) 

Hans 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------



More information about the dev-context mailing list