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

Fields

§kind: EscapeKind

Escape kind

§value: String

Escape value at fault

§errs: ParseErrors

Parse errors

Contents of an escape failed to parse.

§

RestrictedExpressionError(RestrictedExprError)

Restricted expression error

§

ExpectedLiteralEntityRef

Fields

§ctx: Box<JsonDeserializationErrorContext>

Context of this error

§got: Box<Either<Value, Expr>>

the expression we got instead

A field that needs to be a literal entity reference, was some other JSON value

§

ExpectedExtnValue

Fields

§ctx: Box<JsonDeserializationErrorContext>

Context of this error

§got: Box<Either<Value, Expr>>

the expression we got instead

A field that needs to be an extension value, was some other JSON value

§

ContextCreation(ContextCreationError)

Errors creating the request context from JSON

§

ActionParentIsNotAction

Fields

§uid: EntityUID

Action entity that had the invalid parent

§parent: EntityUID

Parent that is invalid

Parents of actions should be actions, but this action has a non-action parent

§

MissingImpliedConstructor

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

Schema-based parsing needed an implicit extension constructor, but no suitable constructor was found

§

DuplicateKeyInRecordLiteral

Fields

§ctx: Box<JsonDeserializationErrorContext>

Context of this error

§key: SmolStr

The key that appeared two or more times

The same key appears two or more times in a single record literal

§

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

Fields

§ctx: Box<JsonDeserializationErrorContext>

Context of this error

§record_attr: SmolStr

Name of the (Record) attribute which was unexpected

During schema-based parsing, encountered this attribute on a record, but that attribute shouldn’t exist on that record

§

MissingRequiredRecordAttr

Fields

§ctx: Box<JsonDeserializationErrorContext>

Context of this error

§record_attr: SmolStr

Name of the (Record) attribute which was expected

During schema-based parsing, didn’t encounter this attribute of a record, but that attribute should have existed

§

TypeMismatch

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

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.)

§

HeterogeneousSet

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

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.)

§

ExtensionFunctionLookup

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

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.)

§

UnknownInImplicitConstructorArg

Fields

§ctx: Box<JsonDeserializationErrorContext>

Context of this error

§arg: Box<RestrictedExpr>

Argument which contains an unknown

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.

§

ExprTag(Box<JsonDeserializationErrorContext>)

Raised when a JsonValue contains the no longer supported __expr escape

Trait Implementations§

source§

impl Debug for JsonDeserializationError

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for JsonDeserializationError

source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Error for JsonDeserializationError

source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl From<ContextCreationError> for JsonDeserializationError

source§

fn from(source: ContextCreationError) -> Self

Converts to this type from the input type.
source§

impl From<EntityAttrEvaluationError> for JsonDeserializationError

source§

fn from(source: EntityAttrEvaluationError) -> Self

Converts to this type from the input type.
source§

impl From<Error> for JsonDeserializationError

source§

fn from(source: Error) -> Self

Converts to this type from the input type.
source§

impl From<JsonDeserializationError> for ContextJsonDeserializationError

source§

fn from(source: JsonDeserializationError) -> Self

Converts to this type from the input type.
source§

impl From<JsonDeserializationError> for EntitiesError

source§

fn from(source: JsonDeserializationError) -> Self

Converts to this type from the input type.
source§

impl From<JsonDeserializationError> for FromJsonError

source§

fn from(source: JsonDeserializationError) -> Self

Converts to this type from the input type.
source§

impl From<RestrictedExprError> for JsonDeserializationError

source§

fn from(source: RestrictedExprError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.