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+.
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.
- 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.