ErrorRecord#
- class scikitplot.corpus.ErrorRecord(code, category, message, stage=None, source_id=None, exception_type=None, traceback_text=None, details=<factory>)[source]#
One structured, serialisable diagnostic.
- Parameters:
- codestr
Stable machine-readable identifier, e.g.
"ARCHIVE_MEMBER_REFUSED". Stable across releases so callers may branch on it.- categoryErrorCategory
Coarse classification, for counting and filtering.
- messagestr
Human-readable description. Should name the specific subject.
- stagestr or None, optional
Pipeline stage that produced the record, e.g.
"read","embed".- source_idstr or None, optional
Identifier of the affected input: a
doc_id, path, URL or member name.- exception_typestr or None, optional
Class name of the originating exception, as a string. The exception object itself is deliberately not retained – see the module notes.
- traceback_textstr or None, optional
Formatted traceback, attached only when a caller explicitly opts in via
include_traceback=True.- detailsdict, optional
Additional JSON-compatible context.
- Parameters:
Notes
Developer.
frozen=Truebecause a diagnostic describes something that already happened; mutating it after the fact would make a build manifest disagree with the run it describes.Examples
>>> rec = ErrorRecord( ... code="PARSE_FAILED", ... category=ErrorCategory.PARSE, ... message="malformed XML", ... source_id="doc-1", ... ) >>> rec.code 'PARSE_FAILED' >>> sorted(rec.to_dict())[:3] ['category', 'code', 'details']
A record built from an exception keeps the type name, not the object:
>>> try: ... raise ValueError("boom") ... except ValueError as exc: ... rec = ErrorRecord.from_exception( ... exc, code="X", category=ErrorCategory.INTERNAL ... ) >>> rec.exception_type 'ValueError' >>> rec.traceback_text is None True
- category: ErrorCategory[source]#
- classmethod from_dict(data)[source]#
Rebuild a record from
to_dictoutput.- Parameters:
- datadict
Mapping produced by
to_dict.
- Returns:
- ErrorRecord
- Parameters:
- Return type:
- classmethod from_exception(exc, *, code, category, stage=None, source_id=None, include_traceback=False, details=None)[source]#
Build a record from
excwithout retaining the exception.- Parameters:
- excBaseException
The originating exception. Only its type name and
str()are kept.- codestr
Stable machine-readable identifier.
- categoryErrorCategory or str
Coarse classification.
- stagestr or None, optional
Pipeline stage.
- source_idstr or None, optional
Identifier of the affected input.
- include_tracebackbool, optional
When
True, format and attach the traceback as text. DefaultFalse: a formatted traceback is a string and therefore safe to retain, but it is verbose, so it is opt-in.- detailsdict or None, optional
Additional JSON-compatible context.
- Returns:
- ErrorRecord
A record holding no reference to
excor its frames.
- Parameters:
exc (BaseException)
code (str)
category (ErrorCategory | str)
stage (str | None)
source_id (str | None)
include_traceback (bool)
- Return type:
Notes
Developer. This method is the reason the 139x retention measured in F-R11-02 does not recur: the exception is read and dropped inside this call, so no frame locals survive it.