#[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
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
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.
NotAGeoPackage
The file is not identifiable as a GeoPackage.
Fields
AlreadyExists(PathBuf)
create was asked to overwrite an existing non-empty file.
UnknownEpsgCode
An EPSG code outside the vendored definition subset.
UnknownGeometryType
A gpkg_geometry_columns.geometry_type_name value outside the
spec vocabulary (Annex G).
Fields
InvalidZmFlag
A gpkg_geometry_columns.z or .m value outside 0/1/2.
Fields
NoSuchTable
Introspection was requested for a table that does not exist (its
PRAGMA table_info returned no rows).
NoSuchColumn
A column was requested that the table does not have.
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
declared: ColumnTypeThe column’s declared GeoPackage type.
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.
InvalidDateTimeValue
A DATE or DATETIME column contains text that does not parse.
Fields
source: DateTimeErrorThe 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.
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
declared: GeometryTypeThe declared gpkg_geometry_columns type.
found: GeometryTypeThe 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.
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
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
format: TileFormatThe 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
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
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
ZoomOtherNotEnabled
A pyramid whose zoom levels do not step by factors of two was created
without opting into the gpkg_zoom_other extension.
NoSuchLayer
A layer was requested by a name that is not present in gpkg_contents.
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
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).
ReservedTablePrefix
A table was requested with a name beginning gpkg_, which the spec
reserves for its own tables (Requirement 25).
TableAlreadyExists
A table was created with a name that a table or view already uses.
UnknownSrs
A layer was created referencing an srs_id absent from
gpkg_spatial_ref_sys.
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.
NoSuchMetadata
A metadata reference names a gpkg_metadata row that does not exist.
SelfParentedMetadata
A metadata reference was given itself as its parent, which Requirement 102 forbids.
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.
UnknownReferenceScope
A gpkg_metadata_reference row has a reference_scope that is not
one of the five Requirement 96 allows.
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).
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).
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
extent: Option<BoundingBox>The measured extent, which is what crate::Layer::extent would
have returned. None when the layer had nothing to measure.
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.
ValueCountMismatch
A write supplied a value slice whose length does not match the layer’s non-geometry column count.
Fields
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.
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).
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.
ZmViolation
A written geometry’s z/m presence violates the geometry column’s
declared constraint (gpkg_geometry_columns.z / .m).
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()