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

Fields

§kind: EscapeKind

Escape kind

§value: String

Escape value at fault

§errs: ParseErrors

Parse errors

§

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

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

the expression we got instead

§

ExpectedExtnValue

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

Fields

§ctx: Box<JsonDeserializationErrorContext>

Context of this error

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

the expression we got instead

§

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

§uid: EntityUID

Action entity that had the invalid parent

§parent: EntityUID

Parent that is invalid

§

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

§key: SmolStr

The key that appeared two or more times

§

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

§record_attr: SmolStr

Name of the (Record) attribute which was unexpected

§

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

§record_attr: SmolStr

Name of the (Record) attribute which was expected

§

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

source§

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

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

impl Diagnostic for JsonDeserializationError

source§

fn code(&self) -> Option<Box<dyn Display + '_>>

Unique diagnostic code that can be used to look up more information about this 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 + '_>>

Additional help text related to this Diagnostic. Do you have any advice for the poor soul who’s just run into this issue?
source§

fn severity(&self) -> Option<Severity>

Diagnostic severity. This may be used by ReportHandlers to change the display format of this diagnostic. Read more
source§

fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>

Labels to apply to this Diagnostic’s Diagnostic::source_code
source§

fn source_code(&self) -> Option<&dyn SourceCode>

Source code to apply this Diagnostic’s Diagnostic::labels to.
source§

fn related(&self) -> Option<Box<dyn Iterator<Item = &dyn Diagnostic> + '_>>

Additional related Diagnostics.
source§

fn url(&self) -> Option<Box<dyn Display + '_>>

URL to visit for a more detailed explanation/help about this Diagnostic.
source§

fn diagnostic_source(&self) -> Option<&dyn Diagnostic>

The cause of the error.
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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

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

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.