• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geo-engine / geoengine / 18554766227

16 Oct 2025 08:12AM UTC coverage: 88.843% (+0.3%) from 88.543%
18554766227

push

github

web-flow
build: update dependencies (#1081)

* update sqlfluff

* clippy autofix

* manual clippy fixes

* removal of unused code

* update deps

* upgrade packages

* enable cargo lints

* make sqlfluff happy

* fix chrono parsin error

* clippy

* byte_size

* fix image cmp with tiffs

* remove debug

177 of 205 new or added lines in 38 files covered. (86.34%)

41 existing lines in 20 files now uncovered.

106415 of 119779 relevant lines covered (88.84%)

84190.21 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

65.63
/datatypes/src/error.rs
1
use crate::{
2
    collections::FeatureCollectionError,
3
    primitives::{BoundingBox2D, Coordinate2D, PrimitivesError, TimeInstance, TimeInterval},
4
    raster::RasterDataType,
5
    spatial_reference::SpatialReference,
6
};
7
use snafu::{AsErrorSource, ErrorCompat, IntoError, prelude::*};
8
use std::{any::Any, convert::Infallible, path::PathBuf, sync::Arc};
9
use strum::IntoStaticStr;
10

11
use crate::util::Result;
12

13
pub trait ErrorSource: std::error::Error + Send + Sync + Any + 'static + AsErrorSource {
14
    fn boxed(self) -> Box<dyn ErrorSource>
1✔
15
    where
1✔
16
        Self: Sized + 'static,
1✔
17
    {
18
        Box::new(self)
1✔
19
    }
1✔
20

21
    fn into_any_arc(self: Arc<Self>) -> Arc<dyn Any + Send + Sync>;
22
}
23

24
impl ErrorSource for dyn std::error::Error + Send + Sync + 'static {
NEW
25
    fn into_any_arc(self: Arc<Self>) -> Arc<dyn Any + Send + Sync> {
×
26
        Arc::new(self)
×
27
    }
×
28
}
29

30
impl<T> ErrorSource for T
31
where
32
    T: std::error::Error + Send + Sync + 'static,
33
{
34
    fn into_any_arc(self: Arc<Self>) -> Arc<dyn Any + Send + Sync> {
1✔
35
        self
1✔
36
    }
1✔
37
}
38

39
pub trait BoxedResultExt<T, E>: Sized {
40
    fn boxed_context<C, E2>(self, context: C) -> Result<T, E2>
41
    where
42
        C: IntoError<E2, Source = Box<dyn ErrorSource>>,
43
        E2: std::error::Error + ErrorCompat;
44
}
45

46
impl<T, E> BoxedResultExt<T, E> for Result<T, E>
47
where
48
    E: ErrorSource,
49
{
50
    fn boxed_context<C, E2>(self, context: C) -> Result<T, E2>
4,829✔
51
    where
4,829✔
52
        C: IntoError<E2, Source = Box<dyn ErrorSource>>,
4,829✔
53
        E2: std::error::Error + ErrorCompat,
4,829✔
54
    {
55
        self.map_err(|e| Box::new(e) as Box<dyn ErrorSource>)
4,829✔
56
            .context(context)
4,829✔
57
    }
4,829✔
58
}
59

60
#[derive(Debug, Snafu, IntoStaticStr)]
61
#[snafu(visibility(pub(crate)))]
62
#[snafu(context(suffix(false)))] // disables default `Snafu` suffix
63
pub enum Error {
64
    #[snafu(display("Arrow internal error: {:?}", source))]
65
    ArrowInternal {
66
        source: arrow::error::ArrowError,
67
    },
68

69
    #[snafu(display("ProjInternal error: {:?}", source))]
70
    ProjInternal {
71
        source: proj::ProjError,
72
    },
73
    #[snafu(display("No CoordinateProjector available for: {:?} --> {:?}", from, to))]
74
    NoCoordinateProjector {
75
        from: SpatialReference,
76
        to: SpatialReference,
77
    },
78
    #[snafu(display(
79
        "Could not resolve a Proj string for this SpatialReference: {}",
80
        spatial_ref
81
    ))]
82
    ProjStringUnresolvable {
83
        spatial_ref: SpatialReference,
84
    },
85

86
    #[snafu(display("Field is reserved or already in use: {}", name))]
87
    ColumnNameConflict {
88
        name: String,
89
    },
90

91
    #[snafu(display("Start `{}` must be before end `{}`", start, end))]
92
    TimeIntervalEndBeforeStart {
93
        start: i64,
94
        end: i64,
95
    },
96

97
    #[snafu(display(
98
        "{} cannot be unioned with {} since the intervals are neither intersecting nor contiguous",
99
        i1,
100
        i2
101
    ))]
102
    TimeIntervalUnmatchedIntervals {
103
        i1: TimeInterval,
104
        i2: TimeInterval,
105
    },
106

107
    #[snafu(display(
108
        "{} must be larger than {} and {} must be smaller than {}",
109
        start.inner(),
110
        min.inner(),
111
        end.inner(),
112
        max.inner()
113
    ))]
114
    TimeIntervalOutOfBounds {
115
        start: TimeInstance,
116
        end: TimeInstance,
117
        min: TimeInstance,
118
        max: TimeInstance,
119
    },
120

121
    #[snafu(display(
122
        "{:?} is not a valid index in the bounds {:?}, {:?} ",
123
        index,
124
        min_index,
125
        max_index,
126
    ))]
127
    GridIndexOutOfBounds {
128
        index: Vec<isize>,
129
        min_index: Vec<isize>,
130
        max_index: Vec<isize>,
131
    },
132

133
    #[snafu(display("{:?} is not a valid index in the bounds 0, {:?} ", index, max_index,))]
134
    LinearIndexOutOfBounds {
135
        index: usize,
136
        max_index: usize,
137
    },
138

139
    #[snafu(display("Invalid GridIndex ({:?}), reason: \"{}\".", grid_index, description))]
140
    InvalidGridIndex {
141
        grid_index: Vec<usize>,
142
        description: &'static str,
143
    },
144

145
    #[snafu(display("Invalid raster operation. Reason: \"{}\".", description))]
146
    InvalidRasterOperation {
147
        description: &'static str,
148
    },
149

150
    #[snafu(display(
151
        "Dimension capacity  ≠ data capacity ({} ≠ {})",
152
        dimension_cap,
153
        data_cap
154
    ))]
155
    DimensionCapacityDoesNotMatchDataCapacity {
156
        dimension_cap: usize,
157
        data_cap: usize,
158
    },
159

160
    #[snafu(display(
161
        "The conditions ll.x <= ur.x && ll.y <= ur.y are not met by ll:{} ur:{}",
162
        lower_left_coordinate,
163
        upper_right_coordinate
164
    ))]
165
    InvalidBoundingBox {
166
        lower_left_coordinate: Coordinate2D,
167
        upper_right_coordinate: Coordinate2D,
168
    },
169

170
    #[snafu(display(
171
        "Mask length ≠ collection length ({} ≠ {})",
172
        mask_length,
173
        collection_length
174
    ))]
175
    MaskLengthDoesNotMatchCollectionLength {
176
        mask_length: usize,
177
        collection_length: usize,
178
    },
179

180
    #[snafu(display("Feature collection error: {source}"))]
181
    FeatureCollection {
182
        source: FeatureCollectionError,
183
    },
184

185
    #[snafu(display("FeatureData exception: {}", details))]
186
    FeatureData {
187
        details: String,
188
    },
189

190
    #[snafu(display("FeatureCollectionBuilder exception: {}", details))]
191
    FeatureCollectionBuilder {
192
        details: String,
193
    },
194

195
    #[snafu(display("Plot exception: {}", details))]
196
    Plot {
197
        details: String,
198
    },
199

200
    #[snafu(display("Colorizer exception: {}", details))]
201
    Colorizer {
202
        details: String,
203
    },
204

205
    #[snafu(display("Primitives error: {source}"))]
206
    Primitives {
207
        source: PrimitivesError,
208
    },
209

210
    #[snafu(display("Blit exception: {}", details))]
211
    Blit {
212
        details: String,
213
    },
214
    #[snafu(display("NonMatchingRasterTypes: a=\"{:?}\", b=\"{:?}\"", a, b))]
215
    NonMatchingRasterTypes {
216
        a: RasterDataType,
217
        b: RasterDataType,
218
    },
219
    #[snafu(display(
220
        "Invalid Grid bounds: Each eleemnt in {:?} must be <= the corresponding element in {:?}.",
221
        min,
222
        max
223
    ))]
224
    InvalidGridBounds {
225
        min: Vec<isize>,
226
        max: Vec<isize>,
227
    },
228
    #[snafu(display("InvalidSpatialReferenceString: {}", spatial_reference_string))]
229
    InvalidSpatialReferenceString {
230
        spatial_reference_string: String,
231
    },
232

233
    #[snafu(display("ParseU32: {}", source))]
234
    ParseU32 {
235
        source: <u32 as std::str::FromStr>::Err,
236
    },
237
    InvalidTypedGridConversion,
238
    InvalidTypedValueConversion,
239

240
    InvalidUuid,
241

242
    #[snafu(display("NoDateTimeValid: {:?}", time_instance))]
243
    NoDateTimeValid {
244
        time_instance: TimeInstance,
245
    },
246

247
    #[snafu(display("The datetime {year}-{month:02}-{day:02} is out of bounds."))]
248
    DateTimeOutOfBounds {
249
        year: i32,
250
        month: u32,
251
        day: u32,
252
    },
253

254
    #[snafu(display(
255
        "The supplied spatial bounds are empty: {} {}",
256
        lower_left_coordinate,
257
        upper_right_coordinate
258
    ))]
259
    EmptySpatialBounds {
260
        lower_left_coordinate: Coordinate2D,
261
        upper_right_coordinate: Coordinate2D,
262
    },
263

264
    #[snafu(display("GdalError: {}", source))]
265
    Gdal {
266
        source: gdal::errors::GdalError,
267
    },
268

269
    GdalRasterDataTypeNotSupported,
270

271
    NoMatchingVectorDataTypeForOgrGeometryType,
272

273
    NoMatchingFeatureDataTypeForOgrFieldType,
274

275
    #[snafu(display("The proj definition \"{proj_definition}\" is invalid."))]
276
    InvalidProjDefinition {
277
        proj_definition: String,
278
    },
279
    #[snafu(display("The proj definition \"{proj_string}\" does not define an area of use."))]
280
    NoAreaOfUseDefined {
281
        proj_string: String,
282
    },
283
    #[snafu(display("{bounds_a} does not intersect with {bounds_b}"))]
284
    SpatialBoundsDoNotIntersect {
285
        bounds_a: BoundingBox2D,
286
        bounds_b: BoundingBox2D,
287
    },
288

289
    #[snafu(display("The output box {bbox} is empty"))]
290
    OutputBboxEmpty {
291
        bbox: BoundingBox2D,
292
    },
293

294
    WrongMetadataType,
295

296
    #[snafu(display(
297
        "The conditions ul.x < lr.x && ul.y < lr.y are not met by ul:{} lr:{}",
298
        upper_left_coordinate,
299
        lower_right_coordinate
300
    ))]
301
    InvalidSpatialPartition {
302
        upper_left_coordinate: Coordinate2D,
303
        lower_right_coordinate: Coordinate2D,
304
    },
305

306
    #[snafu(display("Missing raster property: {}", property))]
307
    MissingRasterProperty {
308
        property: String,
309
    },
310

311
    TimeStepIterStartMustNotBeBeginOfTime,
312

313
    #[snafu(display(
314
        "The number designated as minimum ({min}) is bigger than the maximum ({max})"
315
    ))]
316
    MinMustBeSmallerThanMax {
317
        min: f64,
318
        max: f64,
319
    },
320

321
    #[snafu(display("The colorizer cannot be rescaled: {colorizer}"))]
322
    ColorizerRescaleNotSupported {
323
        colorizer: String,
324
    },
325

326
    #[snafu(display("The spatial reference {a} does not intersect with {b}"))]
327
    SpatialReferencesDoNotIntersect {
328
        a: SpatialReference,
329
        b: SpatialReference,
330
    },
331

332
    #[snafu(display("IO error"))]
333
    Io {
334
        source: std::io::Error,
335
    },
336

337
    #[snafu(display("The sub path '{}' escapes the base path '{}'", sub_path.display(), base.display()))]
338
    SubPathMustNotEscapeBasePath {
339
        base: PathBuf,
340
        sub_path: PathBuf,
341
    },
342

343
    UnexpectedInvalidDbTypeConversion,
344

345
    DuplicateBandInQueryBandSelection,
346
    QueryBandSelectionMustNotBeEmpty,
347

348
    #[snafu(display("Invalid number of suffixes, expected {} found {}", expected, found))]
349
    InvalidNumberOfSuffixes {
350
        expected: usize,
351
        found: usize,
352
    },
353
    #[snafu(display("Insufficient number of suffixes"))]
354
    InsufficientNumberOfSuffixes,
355
    #[snafu(display("Duplicate suffixes are not allowed"))]
356
    DuplicateSuffixesNotAllowed,
357
    #[snafu(display("Empty name is not allowed"))]
358
    EmptyNameNotAllowed,
359
    #[snafu(display("Duplicate name is not allowed"))]
360
    DuplicateNameNotAllowed,
361
    #[snafu(display("Invalid number of new names, expected{} found {}", expected, found))]
362
    InvalidNumberOfNewNames {
363
        expected: usize,
364
        found: usize,
365
    },
366
}
367

368
impl From<arrow::error::ArrowError> for Error {
369
    fn from(source: arrow::error::ArrowError) -> Self {
×
370
        Error::ArrowInternal { source }
×
371
    }
×
372
}
373

374
impl From<proj::ProjError> for Error {
375
    fn from(source: proj::ProjError) -> Self {
×
376
        Error::ProjInternal { source }
×
377
    }
×
378
}
379

380
impl From<Infallible> for Error {
381
    fn from(_: Infallible) -> Self {
×
382
        unreachable!("This function cannot be called on a non-failing type")
×
383
    }
384
}
385

386
impl From<gdal::errors::GdalError> for Error {
387
    fn from(gdal_error: gdal::errors::GdalError) -> Self {
120✔
388
        Self::Gdal { source: gdal_error }
120✔
389
    }
120✔
390
}
391

392
impl From<std::io::Error> for Error {
393
    fn from(e: std::io::Error) -> Self {
1✔
394
        Self::Io { source: e }
1✔
395
    }
1✔
396
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc