Expand description
Error subsystem (§21, §85 Phase 1).
Implements the libxml2 error reporting infrastructure:
xmlErrorstruct management- Error domain/code registry
- Structured error callbacks (thread-local storage)
- Generic error callbacks (thread-local storage)
- Last-error tracking (thread-local
xmlGetLastError,xmlResetLastError,xmlCopyError) - Error message formatting
xmlRaiseError()— the central error reporting function
§UPSTREAM-PARITY
libxml2 has a two-tier error system:
-
Structured errors —
xmlStructuredErrorFuncreceives anxmlErrorPtrwith all structured fields (domain, code, level, line, etc.) -
Generic errors —
xmlGenericErrorFuncreceives a formatted string (printf-style). This is the older system, still widely used.
Both systems coexist. When both handlers are set, both are called.
The last error is stored thread-locally for retrieval via xmlGetLastError.
§Phase 1 status
Complete — all error functions are implemented. Variadic message formatting will be enhanced in Phase 2+.
Enums§
- Generic
Delivery - How a raise delivers to the generic side of the error system (upstream
xmlVRaiseErrorchannel selection, error.c 2.15).
Functions§
- copy_
error ⚠ - Copy an error from one location to another.
- format_
error_ message - Format an error message.
- get_
last_ error - Get the last error for the current thread.
- raise_
error ⚠ - Raise an error — the central error reporting function.
- raise_
error_ ⚠streamed - Raise an error with upstream’s full routing (error.c 2.15
xmlVRaiseError): update the last error, then deliver to the structured handler or the selected generic channel — never both. - reset_
error ⚠ - Reset an error structure to its default state.
- reset_
last_ error - Reset the last error for the current thread.
- set_
generic_ ⚠error_ func - Set the generic error handler.
- set_
structured_ ⚠error_ func - Set the structured error handler.
- xmlParser
Error ⚠ - Default SAX v1 error handler —
void xmlParserError(void *ctx, const char *msg, ...). - xmlParser
Validity ⚠Error - Default validity error handler —
void xmlParserValidityError(void *ctx, const char *msg, ...). - xmlParser
Validity ⚠Warning - Default validity warning handler —
void xmlParserValidityWarning(void *ctx, const char *msg, ...). - xmlParser
Warning ⚠ - Default SAX v1 warning handler —
void xmlParserWarning(void *ctx, const char *msg, ...).