1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
//! Error types for oxigdal-gpkg
use thiserror::Error;
/// Errors that can occur when parsing GeoPackage / SQLite files.
#[derive(Debug, Error)]
pub enum GpkgError {
/// The binary data does not conform to the expected format.
#[error("Invalid format: {0}")]
InvalidFormat(String),
/// An I/O error occurred while reading.
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
/// The GeoPackage geometry blob does not start with the expected magic bytes (0x47 0x50).
#[error("Invalid GeoPackage geometry magic bytes")]
InvalidGeometryMagic,
/// A WKB geometry could not be parsed.
#[error("WKB parse error: {0}")]
WkbParseError(String),
/// The WKB type code is not recognised.
#[error("Unknown WKB geometry type: {0}")]
UnknownWkbType(u32),
/// A parse operation needed more bytes than were available.
#[error("Insufficient data: needed {needed} bytes, available {available}")]
InsufficientData {
/// Number of bytes required by the operation.
needed: usize,
/// Number of bytes actually present in the buffer.
available: usize,
},
/// An advisory file-locking operation failed.
#[error("Locking error: {0}")]
LockingError(String),
/// The WAL file header begins with an unrecognised magic number.
#[error("Invalid WAL magic: {0:#010x}")]
InvalidWalMagic(u32),
/// A WAL frame's cumulative checksum does not match the expected value.
#[error("WAL checksum mismatch at frame for page {page}")]
WalChecksumMismatch {
/// The 1-indexed database page number of the offending frame.
page: u32,
},
/// The WAL page size differs from the expected value.
#[error("WAL page size mismatch: expected {expected}, actual {actual}")]
WalSizeMismatch {
/// Expected page size derived from the main database.
expected: u32,
/// Actual page size read from the WAL header.
actual: u32,
},
/// The requested SQLite table was not found in the master page.
#[error("Table not found: {0}")]
TableNotFound(String),
/// The requested tile set table was not found or has no tile data.
#[error("Tile set not found: {0}")]
TileSetNotFound(String),
/// A single row's encoded size exceeds the maximum that fits in one leaf page.
#[error("Row size {size} bytes exceeds single-leaf-page maximum {max} bytes")]
RowOverflowsPage {
/// Size of the row in bytes.
size: usize,
/// Maximum allowed row size in bytes.
max: usize,
},
/// Geometry type has no corresponding representation in the target format.
#[error("Unsupported geometry type for conversion: {kind}")]
UnsupportedGeometry {
/// Name of the geometry kind that cannot be converted.
kind: String,
},
/// A string-typed metadata value could not be parsed into its typed form.
#[error("Parse error: {0}")]
ParseError(String),
/// A cell value failed validation against a `gpkg_data_column_constraints`
/// rule. Reported by [`crate::schema_constraints::ConstraintValidator`].
#[error("constraint violation for '{constraint_name}': {reason}")]
ConstraintViolation {
/// Name of the violated constraint (matches `constraint_name` column).
constraint_name: String,
/// Human-readable reason explaining why the value failed.
reason: String,
},
/// A CRS reprojection operation failed. Reported by
/// `CrsReprojector` (feature-gated) when the underlying
/// `oxigdal_proj::Transformer` returns an error.
#[error("CRS reprojection failed: {0}")]
ReprojectionError(String),
/// The named gridded coverage table was not found in the GeoPackage.
///
/// Reported when a caller explicitly requests a coverage by name that does
/// not appear in `gpkg_2d_gridded_coverage_ancillary`.
#[error("Gridded coverage not found: {0}")]
CoverageNotFound(String),
/// The `datatype` column in `gpkg_2d_gridded_coverage_ancillary` contains an
/// unrecognised value (expected `"integer"` or `"float"`).
#[error("Invalid coverage datatype: {0}")]
InvalidCoverageDatatype(String),
/// FlatGeoBuf export failed.
#[error("flatgeobuf export error: {0}")]
FlatGeoBufExportError(String),
/// Feature with the given FID was not found in the snapshot.
#[error("Feature not found: fid={0}")]
FeatureNotFound(i64),
/// A buffered-rewrite mutation operation failed.
#[error("Mutation error: {0}")]
MutationError(String),
/// MBTiles export error
#[error("MBTiles export error: {0}")]
MbTilesExportError(String),
/// Error from the change tracking subsystem.
#[error("change tracking error: {0}")]
ChangeTrackingError(String),
}