pub struct JsonErrorData {
pub msg: String,
pub doc: Option<String>,
pub pos: usize,
pub lineno: usize,
pub colno: usize,
}Expand description
Structured fields of a json.JSONDecodeError, mirroring CPython’s msg /
doc / pos / lineno / colno exception attributes.
As with UnicodeErrorData, the payload exists so host bindings can
construct a real json.JSONDecodeError instead of falling back to a plain
ValueError; sandboxed code never sees these fields. lineno/colno are
carried explicitly rather than recomputed from doc because doc may be
absent (see JsonErrorData::MAX_DOC_LEN).
Fields§
§msg: StringThe bare error message, without the : line N column M (char K)
suffix the formatted exception message carries.
doc: Option<String>The document being parsed, matching CPython’s exc.doc. None when
the document exceeds JsonErrorData::MAX_DOC_LEN or is not valid
UTF-8 (json.loads on bytes input).
pos: usizeCharacter index of the error in doc, matching CPython’s exc.pos.
lineno: usize1-based line of the error, matching CPython’s exc.lineno.
colno: usize1-based column of the error, matching CPython’s exc.colno.
Implementations§
Source§impl JsonErrorData
impl JsonErrorData
Sourcepub const MAX_DOC_LEN: usize
pub const MAX_DOC_LEN: usize
Document size cap, mirroring UnicodeErrorData::MAX_OBJECT_LEN:
exception payloads are copied into the host once they escape the worker,
so doc is dropped (not truncated — a partial
document would misplace pos) for larger inputs.
Trait Implementations§
Source§impl Clone for JsonErrorData
impl Clone for JsonErrorData
Source§fn clone(&self) -> JsonErrorData
fn clone(&self) -> JsonErrorData
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more