use thiserror::Error;
use super::JsonCollectionKind;
use super::JsonIntegerSignedness;
use super::JsonMapKeyKind;
use super::JsonSerializerStateError;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Error)]
pub enum JsonSerializationErrorKind {
#[error("JSON integer is outside the supported 64-bit range")]
IntegerOutOfRange {
signedness: JsonIntegerSignedness,
},
#[error("non-finite float")]
NonFiniteFloat,
#[error("invalid JSON number representation")]
InvalidNumberRepresentation,
#[error("unsupported JSON object key")]
UnsupportedMapKey {
kind: JsonMapKeyKind,
},
#[error("duplicate JSON object key")]
DuplicateObjectKey,
#[error("invalid raw JSON value")]
InvalidRawValue,
#[error("JSON collection length overflow")]
CollectionLengthOverflow {
kind: JsonCollectionKind,
},
#[error("invalid serializer state")]
InvalidSerializerState {
reason: JsonSerializerStateError,
},
#[error("display formatting failed during JSON serialization")]
DisplayFormattingFailed,
#[error("custom JSON serialization failed")]
CustomSerialization,
}