pub enum JsonDeserializationError {
Show 19 variants
Serde(Error),
ParseEscape {
kind: EscapeKind,
value: String,
errs: ParseErrors,
},
RestrictedExpressionError(RestrictedExpressionError),
ExtensionsError(ExtensionsError),
ExpectedLiteralEntityRef {
ctx: Box<JsonDeserializationErrorContext>,
got: Box<Expr>,
},
ExpectedExtnValue {
ctx: Box<JsonDeserializationErrorContext>,
got: Box<Expr>,
},
ExpectedContextToBeRecord {
got: Box<RestrictedExpr>,
},
ActionParentIsNotAction {
uid: EntityUID,
parent: EntityUID,
},
MissingImpliedConstructor {
ctx: Box<JsonDeserializationErrorContext>,
return_type: Box<SchemaType>,
arg_type: Box<SchemaType>,
},
UnexpectedEntityType {
uid: EntityUID,
suggested_types: Vec<EntityType>,
},
UndeclaredAction {
uid: EntityUID,
},
ActionDeclarationMismatch {
uid: EntityUID,
},
UnexpectedEntityAttr {
uid: EntityUID,
attr: SmolStr,
},
UnexpectedRecordAttr {
ctx: Box<JsonDeserializationErrorContext>,
record_attr: SmolStr,
},
MissingRequiredEntityAttr {
uid: EntityUID,
attr: SmolStr,
},
MissingRequiredRecordAttr {
ctx: Box<JsonDeserializationErrorContext>,
record_attr: SmolStr,
},
TypeMismatch {
ctx: Box<JsonDeserializationErrorContext>,
expected: Box<SchemaType>,
actual: Box<SchemaType>,
},
HeterogeneousSet {
ctx: Box<JsonDeserializationErrorContext>,
ty1: Box<SchemaType>,
ty2: Box<SchemaType>,
},
InvalidParentType {
ctx: Box<JsonDeserializationErrorContext>,
uid: EntityUID,
parent_ty: Box<EntityType>,
},
}
Expand description
Errors thrown during deserialization from JSON
Variants§
Serde(Error)
Error thrown by the serde_json
crate
ParseEscape
Contents of an escape failed to parse.
Note that escape __expr
is deprecated and once it is
removed, EscapeKind::Expr
will also be removed
RestrictedExpressionError(RestrictedExpressionError)
Restricted expression error
ExtensionsError(ExtensionsError)
Error thrown by an operation on Extensions
ExpectedLiteralEntityRef
A field that needs to be a literal entity reference, was some other JSON value
Fields
ctx: Box<JsonDeserializationErrorContext>
Context of this error
ExpectedExtnValue
A field that needs to be an extension value, was some other JSON value
Fields
ctx: Box<JsonDeserializationErrorContext>
Context of this error
ExpectedContextToBeRecord
Contexts need to be records, but we got some other JSON value
Fields
got: Box<RestrictedExpr>
Expression we got instead
ActionParentIsNotAction
Parents of actions should be actions, but this action has a non-action parent
Fields
MissingImpliedConstructor
Schema-based parsing needed an implicit extension constructor, but no suitable constructor was found
Fields
ctx: Box<JsonDeserializationErrorContext>
Context of this error
return_type: Box<SchemaType>
return type of the constructor we were looking for
arg_type: Box<SchemaType>
argument type of the constructor we were looking for
UnexpectedEntityType
During schema-based parsing, encountered an entity of a type which is not declared in the schema. Note that this error is only used for non-Action entity types.
Fields
suggested_types: Vec<EntityType>
Suggested similar entity types that actually are declared in the schema (if any)
UndeclaredAction
During schema-based parsing, encountered an action which was not declared in the schema
ActionDeclarationMismatch
During schema-based parsing, encountered an action whose definition doesn’t precisely match the schema’s declaration of that action
UnexpectedEntityAttr
During schema-based parsing, encountered this attribute on this entity, but that attribute shouldn’t exist on entities of this type
Fields
UnexpectedRecordAttr
During schema-based parsing, encountered this attribute on a record, but that attribute shouldn’t exist on that record
Fields
ctx: Box<JsonDeserializationErrorContext>
Context of this error
MissingRequiredEntityAttr
During schema-based parsing, didn’t encounter this attribute of an entity, but that attribute should have existed
Fields
MissingRequiredRecordAttr
During schema-based parsing, didn’t encounter this attribute of a record, but that attribute should have existed
Fields
ctx: Box<JsonDeserializationErrorContext>
Context of this error
TypeMismatch
During schema-based parsing, the given attribute on the given entity had a different type than the schema indicated to expect
Fields
ctx: Box<JsonDeserializationErrorContext>
Context of this error
expected: Box<SchemaType>
Type which was expected
actual: Box<SchemaType>
Type which was encountered instead
HeterogeneousSet
During schema-based parsing, found a set whose elements don’t all have the same type. This doesn’t match any possible schema.
Fields
ctx: Box<JsonDeserializationErrorContext>
Context of this error
ty1: Box<SchemaType>
First element type which was found
ty2: Box<SchemaType>
Second element type which was found
InvalidParentType
During schema-based parsing, found a parent of a type that’s not allowed for that entity
Fields
ctx: Box<JsonDeserializationErrorContext>
Context of this error
parent_ty: Box<EntityType>
Parent type which was invalid
Trait Implementations§
source§impl Debug for JsonDeserializationError
impl Debug for JsonDeserializationError
source§impl Display for JsonDeserializationError
impl Display for JsonDeserializationError
source§impl Error for JsonDeserializationError
impl Error for JsonDeserializationError
source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
source§impl From<Error> for JsonDeserializationError
impl From<Error> for JsonDeserializationError
source§impl From<ExtensionsError> for JsonDeserializationError
impl From<ExtensionsError> for JsonDeserializationError
source§fn from(source: ExtensionsError) -> Self
fn from(source: ExtensionsError) -> Self
source§impl From<JsonDeserializationError> for EntitiesError
impl From<JsonDeserializationError> for EntitiesError
source§fn from(source: JsonDeserializationError) -> Self
fn from(source: JsonDeserializationError) -> Self
source§impl From<JsonDeserializationError> for EstToAstError
impl From<JsonDeserializationError> for EstToAstError
source§fn from(source: JsonDeserializationError) -> Self
fn from(source: JsonDeserializationError) -> Self
source§impl From<RestrictedExpressionError> for JsonDeserializationError
impl From<RestrictedExpressionError> for JsonDeserializationError
source§fn from(source: RestrictedExpressionError) -> Self
fn from(source: RestrictedExpressionError) -> Self
Auto Trait Implementations§
impl Freeze for JsonDeserializationError
impl !RefUnwindSafe for JsonDeserializationError
impl Send for JsonDeserializationError
impl Sync for JsonDeserializationError
impl Unpin for JsonDeserializationError
impl !UnwindSafe for JsonDeserializationError
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more