pub enum JsonDeserializationError {
Show 18 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>,
},
DuplicateKeyInRecordLiteral {
ctx: Box<JsonDeserializationErrorContext>,
key: SmolStr,
},
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>),
}
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
DuplicateKeyInRecordLiteral
The same key appears two or more times in a single record literal
Fields
ctx: Box<JsonDeserializationErrorContext>
Context of this error
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
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
.