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? For instance, right now one of my bits of code has the following: \doifdefinedelse{\??ma :columntype:#1} {\csname \??ma :columntype:#1\endcsname #2\@nil} {\error{Undefined column type: #1}} I'd like to replace the \error in the last line with something that reports a more useful error message than "! Undefined control sequence." Thanks! - Brooks
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 } Cheers, Taco
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 -----------------------------------------------------------------
participants (3)
-
Brooks Moses
-
Hans Hagen
-
Taco Hoekwater