Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 46 variants Sqlite(Error), Core(Error), Arrow(ArrowError), ArrowValueMismatch { column: String, expected: &'static str, found: &'static str, }, UnsupportedArrowType { data_type: String, }, NotAGeoPackage { reason: &'static str, application_id: u32, user_version: u32, }, AlreadyExists(PathBuf), UnknownEpsgCode { code: i32, }, UnknownGeometryType { table_name: String, name: String, }, InvalidZmFlag { table_name: String, column: &'static str, value: i64, }, NoSuchTable { table_name: String, }, NoSuchColumn { table_name: String, column_name: String, }, ValueTypeMismatch { column: String, declared: ColumnType, found: &'static str, }, NonBooleanInteger { column: String, value: i64, }, InvalidDateTimeValue { column: String, text: String, source: DateTimeError, }, GeometryValueUnsupported { column: String, }, GeometryTypeMismatch { table_name: String, column_name: String, declared: GeometryType, found: GeometryType, }, Tile(TileError), NoTileMatrixSet { table_name: String, }, UnknownZoomLevel { table_name: String, zoom_level: i64, }, TileFormatNotAllowed { table_name: String, format: TileFormat, }, ColumnConstraintViolation { table_name: String, column_name: String, constraint_name: String, constraint: String, value: String, }, InvalidColumnConstraint { constraint_name: String, reason: &'static str, }, UnsupportedExtension { table_name: String, extension_name: String, scope: String, }, ZoomOtherNotEnabled { table_name: String, }, NoSuchLayer { table_name: String, }, WrongDataType { table_name: String, expected: &'static str, found: String, }, NoGeometryColumn { table_name: String, }, ReservedTablePrefix { table_name: String, }, TableAlreadyExists { table_name: String, }, UnknownSrs { srs_id: i32, }, NonConformantRelationName { relation_name: String, }, NoSuchMetadata { id: i64, }, SelfParentedMetadata { md_file_id: i64, }, MetadataCycle { id: i64, }, UnknownReferenceScope { scope: String, }, MissingGeometrySpec { table_name: String, }, UnexpectedGeometrySpec { table_name: String, }, ExtentPersist { table_name: String, extent: Option<BoundingBox>, source: Box<Error>, }, GeometryNotProjected, DuplicateUpdateColumn { table_name: String, column_name: String, }, ValueCountMismatch { table_name: String, expected: usize, found: usize, }, NoPrimaryKey { table_name: String, }, SpatialIndexExists { table_name: String, column_name: String, }, NoSpatialIndex { table_name: String, column_name: String, }, ZmViolation { table_name: String, column: String, dimension: &'static str, constraint: ZmFlag, verb: &'static str, },
}
Expand description

Errors returned by this crate.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Sqlite(Error)

Underlying SQLite error.

§

Core(Error)

Spec-level error from geopackage-core.

§

Arrow(ArrowError)

Underlying Arrow error (feature arrow).

§

ArrowValueMismatch

A stored value’s storage class cannot go into the Arrow array its column maps to (feature arrow).

The columnar counterpart of Self::ValueTypeMismatch, reported separately because it names an Arrow type rather than a declared GeoPackage one.

Fields

§column: String

The column that was read.

§expected: &'static str

The Arrow type the column maps to.

§found: &'static str

The SQLite storage class actually found: one of NULL, INTEGER, REAL, TEXT, or BLOB.

§

UnsupportedArrowType

A schema field whose Arrow type the columnar reader has no builder for (feature arrow).

Unreachable from a schema this crate derived; it exists so that adding a mapping without adding its builder is an error rather than a panic.

Fields

§data_type: String

The Arrow type that has no builder.

§

NotAGeoPackage

The file is not identifiable as a GeoPackage.

Fields

§reason: &'static str

Why identification failed.

§application_id: u32

The file’s application_id pragma.

§user_version: u32

The file’s user_version pragma.

§

AlreadyExists(PathBuf)

create was asked to overwrite an existing non-empty file.

§

UnknownEpsgCode

An EPSG code outside the vendored definition subset.

Fields

§code: i32

The requested EPSG code.

§

UnknownGeometryType

A gpkg_geometry_columns.geometry_type_name value outside the spec vocabulary (Annex G).

Fields

§table_name: String

The table the row describes.

§name: String

The unrecognised type name as stored.

§

InvalidZmFlag

A gpkg_geometry_columns.z or .m value outside 0/1/2.

Fields

§table_name: String

The table the row describes.

§column: &'static str

Which column had the bad value: "z" or "m".

§value: i64

The value as stored.

§

NoSuchTable

Introspection was requested for a table that does not exist (its PRAGMA table_info returned no rows).

Fields

§table_name: String

The requested table name.

§

NoSuchColumn

A column was requested that the table does not have.

Fields

§table_name: String

The table that was queried.

§column_name: String

The requested column name.

§

ValueTypeMismatch

A stored value’s SQLite storage class is incompatible with the column’s declared GeoPackage type; the value is surfaced rather than coerced.

Fields

§column: String

The column that was read.

§declared: ColumnType

The column’s declared GeoPackage type.

§found: &'static str

The SQLite storage class actually found: one of NULL, INTEGER, REAL, TEXT, or BLOB.

§

NonBooleanInteger

A BOOLEAN column contains an INTEGER other than 0 or 1, read under StorageStrictness::Strict.

The storage class is the right one, so this is not a Self::ValueTypeMismatch: the value itself is outside what the declared type permits. Lenient conversion, the default, reads any non-zero integer as true instead.

Fields

§column: String

The column that was read.

§value: i64

The integer the column actually contains.

§

InvalidDateTimeValue

A DATE or DATETIME column contains text that does not parse.

Fields

§column: String

The column that was read.

§text: String

The offending text as stored.

§source: DateTimeError

The underlying parse error.

§

GeometryValueUnsupported

A geometry column was read through the value API, which handles only non-geometry columns; geometry is read through the feature API.

Fields

§column: String

The geometry column that was read.

§

GeometryTypeMismatch

A geometry blob’s WKB type does not satisfy the column’s declared gpkg_geometry_columns type (opt-in check; see Layer::with_geometry_type_validation).

Fields

§table_name: String

The feature table.

§column_name: String

The geometry column.

§declared: GeometryType

The declared gpkg_geometry_columns type.

§found: GeometryType

The WKB body’s actual type.

§

Tile(TileError)

A tile pyramid that does not satisfy the spec’s consistency rules (Requirements 45 to 53), or a tile payload that could not be read.

Raised by crate::GeoPackage::create_tile_pyramid and by the tile write path. Reading an existing pyramid never validates it, so a file another implementation wrote opens whatever its matrices say.

§

NoTileMatrixSet

A tile pyramid whose gpkg_tile_matrix_set row is missing, so the extent its tiles are addressed against is unknown.

Fields

§table_name: String

The pyramid that is missing its row.

§

UnknownZoomLevel

A zoom level the pyramid does not declare a gpkg_tile_matrix row for, so it has no grid to address tiles against.

Fields

§table_name: String

The pyramid that was addressed.

§zoom_level: i64

The zoom level that is not declared.

§

TileFormatNotAllowed

A tile payload in an encoding no tile pyramid may contain.

The base spec allows PNG and JPEG (Requirements 36 and 37), and the gpkg_webp extension allows WebP, which the write path registers as it goes. A TIFF belongs to the tiled gridded coverage extension, which this crate does not implement.

Fields

§table_name: String

The pyramid that was written to.

§format: TileFormat

The encoding the payload’s header declared.

§

ColumnConstraintViolation

A written value that a gpkg_schema constraint on its column does not allow.

Raised only when the file was opened with OpenOptions::enforce_column_constraints: the spec makes these constraints advisory, enforced “by SQL triggers or by code in applications that update GeoPackage data values”, so enforcing them is the caller’s decision.

Fields

§table_name: String

The table written to.

§column_name: String

The column whose value was rejected.

§constraint_name: String

The gpkg_data_column_constraints.constraint_name it violates.

§constraint: String

What that constraint allows, rendered for the message.

§value: String

The value, rendered for the message.

§

InvalidColumnConstraint

A gpkg_data_column_constraints constraint the spec’s own rules rule out, found while reading it or rejected while writing it.

Requirements 108 to 114 fix what each constraint_type may contain: a range needs both bounds and needs min below max, an enum or glob needs a value, and the type has to be one of the three. A row outside those rules names what it constrains without saying how.

Fields

§constraint_name: String

The constraint_name the rows share.

§reason: &'static str

What is wrong with it.

§

UnsupportedExtension

A write to a table covered by an extension this crate cannot identify.

Requirement 64 makes every extension one a writer has to understand: read-write affects readers and writers, write-only affects writers. Since an unrecognised extension may constrain the rows, the triggers or the encodings of the table it covers, writing to it could produce a file its own producer can no longer read. This is the “fail fast” that clause 2.3.2 gives the catalogue as its purpose.

Reading never fails for this reason, and an extension this crate can name does not raise it: see ExtensionSupport. A caller who knows the extension is harmless can proceed with OpenOptions::allow_unsupported_extension_writes.

Fields

§table_name: String

The table the write targeted.

§extension_name: String

The gpkg_extensions.extension_name value that blocks it.

§scope: String

That row’s scope value.

§

ZoomOtherNotEnabled

A pyramid whose zoom levels do not step by factors of two was created without opting into the gpkg_zoom_other extension.

Fields

§table_name: String

The pyramid that was rejected.

§

NoSuchLayer

A layer was requested by a name that is not present in gpkg_contents.

Fields

§table_name: String

The requested layer name.

§

WrongDataType

A layer was requested with the wrong accessor: its gpkg_contents data_type does not match the accessor used (crate::GeoPackage::layer expects features, crate::GeoPackage::attributes expects attributes).

Fields

§table_name: String

The layer as named in gpkg_contents.

§expected: &'static str

The data_type the accessor requires.

§found: String

The data_type actually recorded in gpkg_contents.

§

NoGeometryColumn

A spatial (bounding-box) query was requested on a layer that has no geometry column (an attribute layer, or a feature table whose gpkg_geometry_columns row is missing).

Fields

§table_name: String

The layer that was queried.

§

ReservedTablePrefix

A table was requested with a name beginning gpkg_, which the spec reserves for its own tables (Requirement 25).

Fields

§table_name: String

The rejected table name.

§

TableAlreadyExists

A table was created with a name that a table or view already uses.

Fields

§table_name: String

The clashing table name.

§

UnknownSrs

A layer was created referencing an srs_id absent from gpkg_spatial_ref_sys.

Fields

§srs_id: i32

The unregistered spatial reference system identifier.

§

NonConformantRelationName

A relationship was given a relation_name that Requirement 8 does not accept: neither a defined requirements class nor the x-<author>_<name> form.

Fields

§relation_name: String

The rejected value.

§

NoSuchMetadata

A metadata reference names a gpkg_metadata row that does not exist.

Fields

§id: i64

The absent record’s id.

§

SelfParentedMetadata

A metadata reference was given itself as its parent, which Requirement 102 forbids.

Fields

§md_file_id: i64

The record named as both file and parent.

§

MetadataCycle

Walking md_parent_id revisited a record. Requirement 102 forbids only the one-step cycle, so a longer one is a file this crate reports rather than one it can rule out.

Fields

§id: i64

The record the chain returned to.

§

UnknownReferenceScope

A gpkg_metadata_reference row has a reference_scope that is not one of the five Requirement 96 allows.

Fields

§scope: String

The value as the file spells it.

§

MissingGeometrySpec

crate::GeoPackage::create_layer was called with a builder that has no geometry column (use crate::GeoPackage::create_attributes_table for a non-spatial table).

Fields

§table_name: String

The table the builder describes.

§

UnexpectedGeometrySpec

crate::GeoPackage::create_attributes_table was called with a builder that has a geometry column (use crate::GeoPackage::create_layer for a feature table).

Fields

§table_name: String

The table the builder describes.

§

ExtentPersist

crate::Layer::extent measured a layer’s extent but could not record it, for a reason that is not another connection holding a lock.

The measurement succeeded and is included here, so nothing is lost by the failure: the caller can use extent and decide how to treat the unwritable store. Lock contention does not produce this, because a concurrent writer means the measurement may already be stale; what does produce it are conditions under which the store is broken or unwritable in a way that will not clear, such as an unwritable directory, a full disk, or an I/O error.

Fields

§table_name: String

The table whose extent was measured.

§extent: Option<BoundingBox>

The measured extent, which is what crate::Layer::extent would have returned. None when the layer had nothing to measure.

§source: Box<Error>

Why the write failed. Boxed only to keep this variant from setting the size of every Result in the crate.

§

GeometryNotProjected

crate::Feature::geometry was called on a row whose read did not select the geometry column.

Distinct from Ok(None), which means the row’s geometry is NULL. This says the geometry was never read, because crate::Layer::with_columns did not name it or crate::Layer::without_geometry excluded it, and it is an error rather than an empty answer so the two cannot be confused. crate::Feature::has_geometry_column tests for it without erroring.

§

DuplicateUpdateColumn

A partial update named the same column more than once.

SQLite accepts a repeated assignment and applies the last one, so this is rejected rather than resolved: naming a column twice with different values is more likely to be a caller’s mistake than an intention.

Fields

§table_name: String

The table being written.

§column_name: String

The column named twice.

§

ValueCountMismatch

A write supplied a value slice whose length does not match the layer’s non-geometry column count.

Fields

§table_name: String

The table being written.

§expected: usize

The number of non-geometry columns.

§found: usize

The number of values supplied.

§

NoPrimaryKey

A spatial-index operation was requested on a layer whose table has no single-column primary key. The RTree triggers key the index on that column, so one is required to build, repair, or use the index.

Fields

§table_name: String

The table that was queried.

§

SpatialIndexExists

crate::Layer::create_spatial_index was called on a layer whose geometry column already has an RTree spatial index (its rtree_<table>_<column> virtual table already exists).

Fields

§table_name: String

The feature table.

§column_name: String

The geometry column.

§

NoSpatialIndex

crate::Layer::repair_spatial_index was called on a layer that has no RTree triggers to repair. Build an index with crate::Layer::create_spatial_index first.

Fields

§table_name: String

The feature table.

§column_name: String

The geometry column.

§

ZmViolation

A written geometry’s z/m presence violates the geometry column’s declared constraint (gpkg_geometry_columns.z / .m).

Fields

§table_name: String

The feature table.

§column: String

The geometry column.

§dimension: &'static str

Which dimension: "z" or "m".

§constraint: ZmFlag

The column’s declared constraint.

§verb: &'static str

"has" when the geometry includes the dimension, "lacks" when it does not.

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

Source§

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

Returns 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<ArrowError> for Error

Source§

fn from(source: ArrowError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<TileError> for Error

Source§

fn from(source: TileError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

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>,

Source§

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>,

Source§

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.