pub enum ValueError {
ExpectedTable {
found: Value,
},
ExpectedArrayRow {
field: &'static str,
found: Row<'static>,
},
UnexpectedType {
expected: &'static str,
found: Value,
},
VecConversionError {
element_type: &'static str,
source: Box<dyn Error>,
},
MissingField {
field: &'static str,
target_type: &'static str,
remaining_fields: Row<'static>,
},
}
Expand description
Errors related to value conversions, usually when converting to a model
using realm_model
.
Variants§
ExpectedTable
Expected a Table value, found something else. This can happen when
trying to convert a Value
into a Vec<T>
, if the data is not
structured as expected.
ExpectedArrayRow
Expected an array row, but found something else. This can happen when
trying to convert a Row
into a target type. In Realm, if a model has
a field that’s the equivalent of, e.g. Vec<String>
, that is
represented as a subtable, where each row has a single column of type
String
, with name field
. If this
error occurs, it means the row in the subtable does not have the
expected field.
Fields
UnexpectedType
Expected a different type. This could happen if your
realm_model
definition is incorrect, and a
column has a different type than expected.
VecConversionError
Failed to convert a Row
from a subtable into a Vec<T>
, because the
underlying T: TryFrom<Row>>
failed.
Fields
MissingField
Missing field when converting a Row
into a struct. This can happen
if your realm_model
definition is incorrect, and
a column doesn’t exist, or has a different name than expected.