next up previous contents
Next: Defining commands Up: Commands for class and Previous: Safe file commands   Contents

Reporting errors, etc

These commands should be used by third party classes and packages to report errors, or to provide information to authors.


\ClassError {<class-name>} {<error-text>} {<help-text>}
\PackageError {<package-name>} {<error-text>} {<help-text>}

These produce an error message. The <error-text> is displayed and the ? error prompt is shown. If the user types h, they will be shown the <help-text>.

Within the <error-text> and <help-text>: \protect can be used to stop a command from expanding; \MessageBreak causes a line-break; and \space prints a space.

Note that the <error-text> will have a full stop added to it, so do not put one into the argument.

For example:

   \newcommand{\foo}{FOO}
   \PackageError{ethel}{%
      Your hovercraft is full of eels,\MessageBreak
      and \protect\foo\space is \foo
   }{%
      Oh dear! Something's gone wrong.\MessageBreak
      \space \space Try typing \space <<return>>
      \space to proceed, ignoring \protect\foo.
   }
produces this display:
   ! Package ethel Error: Your hovercraft is full of eels,
   (ethel)                and \foo is FOO.

   See the ethel package documentation for explanation.
If the user types h, this will be shown:
   Oh dear! Something's gone wrong.
     Try typing  <<return>>  to proceed, ignoring \foo.


\ClassWarning {<class-name>} {<warning-text>}
\PackageWarning {<package-name>} {<warning-text>}
\ClassWarningNoLine {<class-name>} {<warning-text>}
\PackageWarningNoLine {<package-name>} {<warning-text>}
\ClassInfo {<class-name>} {<info-text>}
\PackageInfo {<package-name>} {<info-text>}

The four Warning commands are similar to the error commands, except that they produce only a warning on the screen, with no error prompt.

The first two, Warning versions, also show the line number where the warning occurred, whilst the second two, WarningNoLine versions, do not.

The two Info commands are similar except that they log the information only in the transcript file, including the line number. There are no NoLine versions of these two.

Within the <warning-text> and <info-text>: \protect can be used to stop a command from expanding; \MessageBreak causes a line-break; and \space prints a space. Also, these should not end with a full stop as one is automatically added.


next up previous contents
Next: Defining commands Up: Commands for class and Previous: Safe file commands   Contents
Johannes L. Braams 2003-05-18