.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "LaTeXML::Common::Error 3pm" .TH LaTeXML::Common::Error 3pm 2024-02-27 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME "LaTeXML::Common::Error" \- Error and Progress Reporting and Logging support. .SH DESCRIPTION .IX Header "DESCRIPTION" \&\f(CW\*(C`LaTeXML::Common::Error\*(C'\fR does some simple stack analysis to generate more informative, readable, error messages for LaTeXML. Its routines are used by the error reporting methods from LaTeXML::Global, namely \f(CW\*(C`Warn\*(C'\fR, \f(CW\*(C`Error\*(C'\fR and \f(CW\*(C`Fatal\*(C'\fR. .PP The general idea is that a minimal amount should be printed to STDERR (possibly with colors, spinners, etc if it is a terminal), and more complete information is printed to a log file. Neither of these are enabled, by default; see below. .ie n .IP """SetVerbosity($verbosity);""" 4 .el .IP \f(CWSetVerbosity($verbosity);\fR 4 .IX Item "SetVerbosity($verbosity);" Controls the verbosity of output to the terminal; default is 0, higher gives more information, lower gives less. A verbosity less than 0 inhibits all output to STDERR. .ie n .IP """UseSTDERR(); ... UseSTDERR(undef);""" 4 .el .IP "\f(CWUseSTDERR(); ... UseSTDERR(undef);\fR" 4 .IX Item "UseSTDERR(); ... UseSTDERR(undef);" \&\f(CW\*(C`UseSTDERR();\*(C'\fR Enables and initializes STDERR to accept messages. If this is not called, there will be no output to STDERR. \&\f(CW\*(C`UseSTDERR(undef);\*(C'\fR disables STDERR from further messages. .ie n .IP """UseLog($path, $append); ... UseLog(undef);""" 4 .el .IP "\f(CWUseLog($path, $append); ... UseLog(undef);\fR" 4 .IX Item "UseLog($path, $append); ... UseLog(undef);" \&\f(CW\*(C`UseLog($path, $append);\*(C'\fR opens a log file on the given path. If \f(CW$append\fR is true, this file will be appended to, otherwise, it will be created initially empty. If this is not called, there will be no log file. \&\f(CW\*(C`UseLog(undef);\*(C'\fR disables and closes the log file. .SS "Error Reporting" .IX Subsection "Error Reporting" The Error reporting functions all take a similar set of arguments, the differences are in the implied severity of the situation, and in the amount of detail that will be reported. .PP The \f(CW$category\fR is a string naming a broad category of errors, such as "undefined". The set is open-ended, but see the manual for a list of recognized categories. \f(CW$object\fR is the object whose presence or lack caused the problem. .PP \&\f(CW$where\fR indicates where the problem occurred; passs in the \f(CW$gullet\fR or \f(CW$stomach\fR if the problem occurred during expansion or digestion; pass in a document node if it occurred there. A string will be used as is; if an undefined value is used, the error handler will try to guess. .PP The \f(CW$message\fR should be a somewhat concise, but readable, explanation of the problem, but ought to not refer to the document or any "incident specific" information, so as to support indexing in build systems. \f(CW@details\fR provides additional lines of information that may be indident specific. .ie n .IP """Fatal($category,$object,$where,$message,@details);""" 4 .el .IP \f(CWFatal($category,$object,$where,$message,@details);\fR 4 .IX Item "Fatal($category,$object,$where,$message,@details);" Signals an fatal error, printing \f(CW$message\fR along with some context. In verbose mode a stack trace is printed. .ie n .IP """Error($category,$object,$where,$message,@details);""" 4 .el .IP \f(CWError($category,$object,$where,$message,@details);\fR 4 .IX Item "Error($category,$object,$where,$message,@details);" Signals an error, printing \f(CW$message\fR along with some context. If in strict mode, this is the same as \fBFatal()\fR. Otherwise, it attempts to continue processing.. .ie n .IP """Warn($category,$object,$where,$message,@details);""" 4 .el .IP \f(CWWarn($category,$object,$where,$message,@details);\fR 4 .IX Item "Warn($category,$object,$where,$message,@details);" Prints a warning message along with a short indicator of the input context, unless verbosity is quiet. .ie n .IP """Info($category,$object,$where,$message,@details);""" 4 .el .IP \f(CWInfo($category,$object,$where,$message,@details);\fR 4 .IX Item "Info($category,$object,$where,$message,@details);" Prints an informational message along with a short indicator of the input context, unless verbosity is quiet. .SS "Progress Reporting" .IX Subsection "Progress Reporting" .ie n .IP """Note($message);""" 4 .el .IP \f(CWNote($message);\fR 4 .IX Item "Note($message);" General status message, printed whenever verbosity at or above 0, to both STDERR and the Log file (when enabled). .ie n .IP """NoteLog($message);""" 4 .el .IP \f(CWNoteLog($message);\fR 4 .IX Item "NoteLog($message);" Prints a status message to the Log file (when enabled). .ie n .IP """NoteSTDERR($message);""" 4 .el .IP \f(CWNoteSTDERR($message);\fR 4 .IX Item "NoteSTDERR($message);" Prints a status message to the terminal (STDERR) (when enabled). .ie n .IP """ProgressSpinup($stage);""" 4 .el .IP \f(CWProgressSpinup($stage);\fR 4 .IX Item "ProgressSpinup($stage);" Begin a processing stage, which will be ended with \f(CWProgressSpindown($stage)\fR; This prints a message to the log such as "(stage... runtime)", where runtime is the time required. In conjunction with \f(CWProgressStep()\fR, creates a progress spinner on STDERR. .ie n .IP """ProgressSpinup($stage);""" 4 .el .IP \f(CWProgressSpinup($stage);\fR 4 .IX Item "ProgressSpinup($stage);" End a processing stage bugin with \f(CW\*(C`ProgressSpindown($stage);\*(C'\fR. .ie n .IP """ProgressStep();""" 4 .el .IP \f(CWProgressStep();\fR 4 .IX Item "ProgressStep();" Steps a progress spinner on STDERR. .SS Debugging .IX Subsection "Debugging" Debugging statements may be embedded throughout the program. These are associated with a feature keyword. A given feature is enabled using the command-line option \&\f(CW\*(C`\-\-debug=feature\*(C'\fR. .ie n .IP """Debug($message) if $LaTeXML::DEBUG{$feature}""" 4 .el .IP "\f(CWDebug($message) if $LaTeXML::DEBUG{$feature}\fR" 4 .IX Item "Debug($message) if $LaTeXML::DEBUG{$feature}" Prints \f(CW$message\fR if debugging has been enabled for the given feature. .ie n .IP """DebuggableFeature($feature,$description)""" 4 .el .IP \f(CWDebuggableFeature($feature,$description)\fR 4 .IX Item "DebuggableFeature($feature,$description)" Declare that \f(CW$feature\fR is a known debuggable feature, and give a description of it. .ie n .IP CheckDebuggable() 4 .el .IP \f(CWCheckDebuggable()\fR 4 .IX Item "CheckDebuggable()" A untility to check and report if all requested debugging features actually have debugging messages declared. .SS "Internal Functions" .IX Subsection "Internal Functions" No user serviceable parts inside. These symbols are not exported. .ie n .IP """$string = LaTeXML::Common::Error::generateMessage($typ,$msg,$lng,@more);""" 4 .el .IP "\f(CW$string = LaTeXML::Common::Error::generateMessage($typ,$msg,$lng,@more);\fR" 4 .IX Item "$string = LaTeXML::Common::Error::generateMessage($typ,$msg,$lng,@more);" Constructs an error or warning message based on the current stack and the current location in the document. \&\f(CW$typ\fR is a short string characterizing the type of message, such as "Error". \&\f(CW$msg\fR is the error message itself. If \f(CW$lng\fR is true, will generate a more verbose message; this also uses the VERBOSITY set in the \f(CW$STATE\fR. Longer messages will show a trace of the objects invoked on the stack, \&\f(CW@more\fR are additional strings to include in the message. .ie n .IP """$string = LaTeXML::Common::Error::stacktrace;""" 4 .el .IP "\f(CW$string = LaTeXML::Common::Error::stacktrace;\fR" 4 .IX Item "$string = LaTeXML::Common::Error::stacktrace;" Return a formatted string showing a trace of the stackframes up until this function was invoked. .ie n .IP """@objects = LaTeXML::Common::Error::objectStack;""" 4 .el .IP "\f(CW@objects = LaTeXML::Common::Error::objectStack;\fR" 4 .IX Item "@objects = LaTeXML::Common::Error::objectStack;" Return a list of objects invoked on the stack. This procedure only considers those stackframes which involve methods, and the objects are those (unique) objects that the method was called on. .SH AUTHOR .IX Header "AUTHOR" Bruce Miller .SH COPYRIGHT .IX Header "COPYRIGHT" Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US.