[dev-context] Error handling in modules?

Taco Hoekwater taco at elvenkind.com
Sun Oct 2 11:02:22 CEST 2005

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)

\def\error#1{\showmessage{brooks}{2}{#1}\wait }
\def\fatal#1{\showmessage{brooks}{3}{#1}\batchmode \wait }

Cheers, Taco

More information about the dev-context mailing list