Enum cpython_json::JsonError
[−]
pub enum JsonError { PythonError(PyErr), SerdeJsonError(Error), TypeError(String, PyResult<String>), DictKeyNotString(PyObject), InvalidFloat, ImpossibleNumber, }
The Error
enum returned by this crate.
Most of the time you will just want a PyErr
, and to_pyerr
will convert to one for you.
Variants
PythonError(PyErr)
A Python exception occurred.
SerdeJsonError(Error)
The PyObject passed could not be converted to a serde_json::Value
because of a
serde_json
error.
TypeError(String, PyResult<String>)
The PyObject passed could not be converted to a serde_json::Value
object because we
didn't recognize it as a valid JSON-supported type.
The error tuple is the type name, then the repr
of the object.
This usually means that Python's json
module wouldn't be able to serialize the object
either. If the Python json
module works but cpython-json
doesn't, please file an
issue with your test case.
DictKeyNotString(PyObject)
A dict
key was not a string object, and so it couldn't be converted to an object. JSON
object keys must always be strings.
InvalidFloat
A number provided is not a valid JSON float (infinite and NaN values are not supported in JSON).
ImpossibleNumber
The serde_json crate lied to us and a Number
is neither u64, i64, or f64.
Methods
impl JsonError
[src]
Trait Implementations
impl Debug for JsonError
[src]
impl Display for JsonError
impl Error for JsonError
fn description(&self) -> &str
A short description of the error. Read more
fn cause(&self) -> Option<&Error>
The lower-level cause of this error, if any. Read more