pub enum JsonDeserializationError {
Show 19 variants
Serde(Error),
ParseEscape {
kind: EscapeKind,
value: String,
errs: ParseErrors,
},
RestrictedExpressionError(RestrictedExprError),
ExpectedLiteralEntityRef {
ctx: Box<JsonDeserializationErrorContext>,
got: Box<Either<Value, Expr>>,
},
ExpectedExtnValue {
ctx: Box<JsonDeserializationErrorContext>,
got: Box<Either<Value, Expr>>,
},
ContextCreation(ContextCreationError),
ActionParentIsNotAction {
uid: EntityUID,
parent: EntityUID,
},
MissingImpliedConstructor {
ctx: Box<JsonDeserializationErrorContext>,
return_type: Box<SchemaType>,
arg_type: Box<SchemaType>,
},
DuplicateKey(DuplicateKey),
EntityAttributeEvaluation(EntityAttrEvaluationError),
EntitySchemaConformance(EntitySchemaConformanceError),
UnexpectedRecordAttr {
ctx: Box<JsonDeserializationErrorContext>,
record_attr: SmolStr,
},
MissingRequiredRecordAttr {
ctx: Box<JsonDeserializationErrorContext>,
record_attr: SmolStr,
},
TypeMismatch {
ctx: Box<JsonDeserializationErrorContext>,
err: TypeMismatchError,
},
HeterogeneousSet {
ctx: Box<JsonDeserializationErrorContext>,
err: HeterogeneousSetError,
},
ExtensionFunctionLookup {
ctx: Box<JsonDeserializationErrorContext>,
err: ExtensionFunctionLookupError,
},
UnknownInImplicitConstructorArg {
ctx: Box<JsonDeserializationErrorContext>,
arg: Box<RestrictedExpr>,
},
ExprTag(Box<JsonDeserializationErrorContext>),
Null(Box<JsonDeserializationErrorContext>),
}
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.
RestrictedExpressionError(RestrictedExprError)
Restricted expression error
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
ContextCreation(ContextCreationError)
Errors creating the request context from JSON
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
DuplicateKey(DuplicateKey)
The same key appears two or more times in a single record
EntityAttributeEvaluation(EntityAttrEvaluationError)
Error when evaluating an entity attribute
EntitySchemaConformance(EntitySchemaConformanceError)
During schema-based parsing, encountered an entity which does not conform to the schema.
This error contains the Entity
analogues some of the other errors
listed below, among other things.
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
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, found a different type than the schema indicated.
(This is used in all cases except inside entity attributes; type mismatches in
entity attributes are reported as Self::EntitySchemaConformance
. As of
this writing, that means this should only be used for schema-based
parsing of the Context
.)
Fields
ctx: Box<JsonDeserializationErrorContext>
Context of this error, which will be something other than EntityAttribute
.
(Type mismatches in entity attributes are reported as
Self::EntitySchemaConformance
.)
err: TypeMismatchError
Underlying error
HeterogeneousSet
During schema-based parsing, found a set whose elements don’t all have the same type. This doesn’t match any possible schema.
(This is used in all cases except inside entity attributes;
heterogeneous sets in entity attributes are reported as
Self::EntitySchemaConformance
. As of this writing, that means this
should only be used for schema-based parsing of the Context
. Note that
for non-schema-based parsing, heterogeneous sets are not an error.)
Fields
ctx: Box<JsonDeserializationErrorContext>
Context of this error, which will be something other than EntityAttribute
.
(Heterogeneous sets in entity attributes are reported as
Self::EntitySchemaConformance
.)
err: HeterogeneousSetError
Underlying error
ExtensionFunctionLookup
During schema-based parsing, error looking up an extension function. This error can occur during schema-based parsing because that may require getting information about any extension functions referenced in the JSON.
(This is used in all cases except inside entity attributes; extension
function lookup errors in entity attributes are reported as
Self::EntitySchemaConformance
. As of this writing, that means this
should only be used for schema-based parsing of the Context
.)
Fields
ctx: Box<JsonDeserializationErrorContext>
Context of this error, which will be something other than
EntityAttribute
.
(Extension function lookup errors in entity attributes are reported
as Self::EntitySchemaConformance
.)
err: ExtensionFunctionLookupError
Underlying error
UnknownInImplicitConstructorArg
During schema-based parsing, found an unknown in an argument to an extension function being processed in implicit-constructor form. This is not currently supported. To pass an unknown to an extension function, use the explicit-constructor form.
Fields
ctx: Box<JsonDeserializationErrorContext>
Context of this error
arg: Box<RestrictedExpr>
Argument which contains an unknown
ExprTag(Box<JsonDeserializationErrorContext>)
Raised when a JsonValue contains the no longer supported __expr
escape
Null(Box<JsonDeserializationErrorContext>)
Raised when the input JSON contains a null
Trait Implementations§
source§impl Debug for JsonDeserializationError
impl Debug for JsonDeserializationError
source§impl Diagnostic for JsonDeserializationError
impl Diagnostic for JsonDeserializationError
source§fn code(&self) -> Option<Box<dyn Display + '_>>
fn code(&self) -> Option<Box<dyn Display + '_>>
Diagnostic
. Ideally also globally unique, and documented
in the toplevel crate’s documentation for easy searching. Rust path
format (foo::bar::baz
) is recommended, but more classic codes like
E0123
or enums will work just fine.source§fn help(&self) -> Option<Box<dyn Display + '_>>
fn help(&self) -> Option<Box<dyn Display + '_>>
Diagnostic
. Do you have any
advice for the poor soul who’s just run into this issue?source§fn severity(&self) -> Option<Severity>
fn severity(&self) -> Option<Severity>
ReportHandler
s to change the display format
of this diagnostic. Read moresource§fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
Diagnostic
’s Diagnostic::source_code
source§fn source_code(&self) -> Option<&dyn SourceCode>
fn source_code(&self) -> Option<&dyn SourceCode>
Diagnostic
’s Diagnostic::labels
to.Diagnostic
s.source§fn url(&self) -> Option<Box<dyn Display + '_>>
fn url(&self) -> Option<Box<dyn Display + '_>>
Diagnostic
.source§fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
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<ContextCreationError> for JsonDeserializationError
impl From<ContextCreationError> for JsonDeserializationError
source§fn from(source: ContextCreationError) -> Self
fn from(source: ContextCreationError) -> Self
source§impl From<EntityAttrEvaluationError> for JsonDeserializationError
impl From<EntityAttrEvaluationError> for JsonDeserializationError
source§fn from(source: EntityAttrEvaluationError) -> Self
fn from(source: EntityAttrEvaluationError) -> Self
source§impl From<Error> for JsonDeserializationError
impl From<Error> for JsonDeserializationError
source§impl From<JsonDeserializationError> for ContextJsonDeserializationError
impl From<JsonDeserializationError> for ContextJsonDeserializationError
source§fn from(source: JsonDeserializationError) -> Self
fn from(source: JsonDeserializationError) -> 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 FromJsonError
impl From<JsonDeserializationError> for FromJsonError
source§fn from(source: JsonDeserializationError) -> Self
fn from(source: JsonDeserializationError) -> Self
source§impl From<RestrictedExprError> for JsonDeserializationError
impl From<RestrictedExprError> for JsonDeserializationError
source§fn from(source: RestrictedExprError) -> Self
fn from(source: RestrictedExprError) -> 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