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

geo-engine / geoengine / 7006568925

27 Nov 2023 02:07PM UTC coverage: 89.651% (+0.2%) from 89.498%
7006568925

push

github

web-flow
Merge pull request #888 from geo-engine/raster_stacks

raster stacking

4032 of 4274 new or added lines in 107 files covered. (94.34%)

12 existing lines in 8 files now uncovered.

113020 of 126066 relevant lines covered (89.65%)

59901.79 hits per line

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

25.0
/operators/src/error.rs
1
use crate::util::statistics::StatisticsError;
2
use geoengine_datatypes::dataset::{DataId, NamedData};
3
use geoengine_datatypes::error::ErrorSource;
4
use geoengine_datatypes::primitives::{FeatureDataType, TimeInterval};
5
use ordered_float::FloatIsNan;
6
use snafu::prelude::*;
7
use std::ops::Range;
8
use std::path::PathBuf;
9

10
#[derive(Debug, Snafu)]
7✔
UNCOV
11
#[snafu(visibility(pub(crate)))]
×
12
#[snafu(context(suffix(false)))] // disables default `Snafu` suffix
13
pub enum Error {
14
    UnsupportedRasterValue,
15

16
    InvalidMeteosatSatellite,
17

18
    InvalidUTCTimestamp,
19

20
    #[snafu(display("InvalidChannel Error (requested channel: {})", channel))]
21
    InvalidChannel {
22
        channel: usize,
23
    },
24

25
    #[snafu(display("InvalidMeasurement Error; expected {}, found: {}", expected, found))]
26
    InvalidMeasurement {
27
        expected: String,
28
        found: String,
29
    },
30

31
    #[snafu(display("CsvSource Error: {}", source))]
32
    CsvSourceReader {
33
        source: csv::Error,
34
    },
35

36
    #[snafu(display("CsvSource Error: {}", details))]
37
    CsvSource {
38
        details: String,
39
    },
40

41
    #[snafu(display("DataTypeError: {}", source))]
42
    DataType {
43
        source: geoengine_datatypes::error::Error,
44
    },
45
    QueryProcessor,
46

47
    #[snafu(display(
48
        "InvalidSpatialReferenceError: expected \"{}\" found \"{}\"",
49
        expected,
50
        found
51
    ))]
52
    InvalidSpatialReference {
53
        expected: geoengine_datatypes::spatial_reference::SpatialReferenceOption,
54
        found: geoengine_datatypes::spatial_reference::SpatialReferenceOption,
55
    },
56

57
    AllSourcesMustHaveSameSpatialReference,
58

59
    #[snafu(display("InvalidOperatorSpec: {}", reason))]
60
    InvalidOperatorSpec {
61
        reason: String,
62
    },
63

64
    // TODO: use something more general than `Range`, e.g. `dyn RangeBounds` that can, however not be made into an object
65
    #[snafu(display("InvalidNumberOfRasterInputsError: expected \"[{} .. {}]\" found \"{}\"", expected.start, expected.end, found))]
66
    InvalidNumberOfRasterInputs {
67
        expected: Range<usize>,
68
        found: usize,
69
    },
70

71
    #[snafu(display("InvalidNumberOfVectorInputsError: expected \"[{} .. {}]\" found \"{}\"", expected.start, expected.end, found))]
72
    InvalidNumberOfVectorInputs {
73
        expected: Range<usize>,
74
        found: usize,
75
    },
76

77
    #[snafu(display("InvalidNumberOfVectorInputsError: expected \"[{} .. {}]\" found \"{}\"", expected.start, expected.end, found))]
78
    InvalidNumberOfInputs {
79
        expected: Range<usize>,
80
        found: usize,
81
    },
82

83
    #[snafu(display("Column {} does not exist", column))]
84
    ColumnDoesNotExist {
85
        column: String,
86
    },
87

88
    #[snafu(display("GdalError: {}", source))]
89
    Gdal {
90
        source: gdal::errors::GdalError,
91
    },
92

93
    #[snafu(display("IOError: {}", source))]
94
    Io {
95
        source: std::io::Error,
96
    },
97

98
    #[snafu(display("SerdeJsonError: {}", source))]
99
    SerdeJson {
100
        source: serde_json::Error,
101
    },
102

103
    InvalidExpression,
104

105
    InvalidNumberOfExpressionInputs,
106

107
    InvalidNoDataValueValueForOutputDataType,
108

109
    #[snafu(display("Invalid type: expected {} found {}", expected, found))]
110
    InvalidType {
111
        expected: String,
112
        found: String,
113
    },
114

115
    #[snafu(display("Invalid operator type: expected {} found {}", expected, found))]
116
    InvalidOperatorType {
117
        expected: String,
118
        found: String,
119
    },
120

121
    #[snafu(display("Invalid vector type: expected {} found {}", expected, found))]
122
    InvalidVectorType {
123
        expected: String,
124
        found: String,
125
    },
126

127
    #[snafu(display("NotNan error: {}", source))]
128
    InvalidNotNanFloatKey {
129
        source: ordered_float::FloatIsNan,
130
    },
131

132
    #[snafu(display("Column types do not match: {:?} - {:?}", left, right))]
133
    ColumnTypeMismatch {
134
        left: FeatureDataType,
135
        right: FeatureDataType,
136
    },
137

138
    UnknownDataset {
139
        name: String,
140
        source: std::io::Error,
141
    },
142

143
    UnknownDatasetName {
144
        name: NamedData,
145
    },
146

147
    CannotResolveDatasetName {
148
        name: NamedData,
149
        source: Box<dyn ErrorSource>,
150
    },
151

152
    #[snafu(display("There is no Model with id {:?} avaiable.", id))]
153
    UnknownModelId {
154
        id: String,
155
    },
156

157
    InvalidDatasetSpec {
158
        name: String,
159
        source: serde_json::Error,
160
    },
161

162
    WorkerThread {
163
        reason: String,
164
    },
165

166
    TimeIntervalColumnNameMissing,
167

168
    TimeIntervalDurationMissing,
169

170
    TimeParse {
171
        source: Box<dyn ErrorSource>,
172
    },
173

174
    TimeInstanceNotDisplayable,
175

176
    InvalidTimeStringPlaceholder {
177
        name: String,
178
    },
179

180
    DatasetMetaData {
181
        source: Box<dyn std::error::Error + Send + Sync>,
182
    },
183

184
    Arrow {
185
        source: arrow::error::ArrowError,
186
    },
187

188
    NoDataWithGivenId {
189
        id: DataId,
190
    },
191

192
    RasterRootPathNotConfigured, // TODO: remove when GdalSource uses LoadingInfo
193

194
    InvalidDataId,
195
    InvalidMetaDataType,
196
    UnknownDataId,
197
    DataIdTypeMissMatch,
198

199
    UnknownDatasetId,
200

201
    // Error during loading of meta data. The source error typically comes from the services crate
202
    #[snafu(display("Could not load meta data: {}", source))]
203
    MetaData {
204
        source: Box<dyn std::error::Error + Send + Sync>,
205
    },
206

207
    // TODO: this error should not be propagated to user
208
    #[snafu(display("Could not open gdal dataset for file path {:?}", file_path))]
209
    CouldNotOpenGdalDataset {
210
        file_path: String,
211
    },
212

213
    FilePathNotRepresentableAsString,
214

215
    TokioJoin {
216
        source: tokio::task::JoinError,
217
    },
218

219
    OgrSourceColumnsSpecMissing,
220

221
    EmptyInput,
222

223
    OgrFieldValueIsNotDateTime,
224
    OgrFieldValueIsNotString,
225
    OgrFieldValueIsNotValidForTimestamp,
226
    OgrColumnFieldTypeMismatch {
227
        expected: String,
228
        field_value: gdal::vector::FieldValue,
229
    },
230

231
    FeatureDataValueMustNotBeNull,
232
    InvalidFeatureDataType,
233
    InvalidRasterDataType,
234

235
    #[snafu(display("No candidate source resolutions were produced."))]
236
    NoSourceResolution,
237

238
    WindowSizeMustNotBeZero,
239

240
    NotYetImplemented,
241

242
    TemporalRasterAggregationLastValidRequiresNoData,
243
    TemporalRasterAggregationFirstValidRequiresNoData,
244
    TemporalRasterAggregationMeanRequiresNoData,
245

246
    NoSpatialBoundsAvailable,
247

248
    ChannelSend,
249
    #[snafu(display("LoadingInfoError: {}", source))]
250
    LoadingInfo {
251
        source: Box<dyn std::error::Error + Send + Sync>,
252
    },
253

254
    CreatingProcessorFailed {
255
        source: Box<dyn std::error::Error + Send + Sync>,
256
    },
257

258
    NotImplemented,
259

260
    TileLimitExceeded {
261
        limit: usize,
262
    },
263

264
    FeatureDataNotAggregatable,
265

266
    FeatureDataLengthMismatch,
267

268
    OgrSqlQuery,
269

270
    GdalRasterDataTypeNotSupported,
271

272
    DynamicGdalSourceSpecHasEmptyTimePlaceholders,
273

274
    #[snafu(display("Input `{}` must be greater than zero at `{}`", name, scope))]
275
    InputMustBeGreaterThanZero {
276
        scope: &'static str,
277
        name: &'static str,
278
    },
279

280
    #[snafu(display("Input `{}` must be zero or positive at `{}`", name, scope))]
281
    InputMustBeZeroOrPositive {
282
        scope: &'static str,
283
        name: &'static str,
284
    },
285

286
    DuplicateOutputColumns,
287

288
    #[snafu(display("Input column `{:}` is missing", name))]
289
    MissingInputColumn {
290
        name: String,
291
    },
292

293
    InvalidGdalFilePath {
294
        file_path: PathBuf,
295
    },
296

297
    #[snafu(display(
298
        "Raster data sets with a different origin than upper left are currently not supported"
299
    ))]
300
    GeoTransformOrigin,
301

302
    #[snafu(display("Statistics error: {}", source))]
303
    Statistics {
304
        source: crate::util::statistics::StatisticsError,
305
    },
306

307
    #[snafu(display("SparseTilesFillAdapter error: {}", source))]
308
    SparseTilesFillAdapter {
309
        source: crate::adapters::SparseTilesFillAdapterError,
310
    },
311
    #[snafu(context(false))]
312
    ExpressionOperator {
313
        source: crate::processing::ExpressionError,
314
    },
315

316
    #[snafu(context(false))]
317
    TimeProjectionOperator {
318
        source: crate::processing::TimeProjectionError,
319
    },
320
    #[snafu(display("MockRasterSource error: {}", source))]
321
    MockRasterSource {
322
        source: crate::mock::MockRasterSourceError,
323
    },
324
    #[snafu(context(false))]
325
    InterpolationOperator {
326
        source: crate::processing::InterpolationError,
327
    },
328
    #[snafu(context(false))]
329
    TimeShift {
330
        source: crate::processing::TimeShiftError,
331
    },
332

333
    AlphaBandAsMaskNotAllowed,
334

335
    SpatialReferenceMustNotBeUnreferenced,
336

337
    #[snafu(context(false))]
338
    RasterKernelError {
339
        source: crate::processing::NeighborhoodAggregateError,
340
    },
341

342
    #[snafu(context(false))]
343
    GdalSource {
344
        source: crate::source::GdalSourceError,
345
    },
346

347
    QueryCanceled,
348

349
    AbortTriggerAlreadyUsed,
350

351
    SubPathMustNotEscapeBasePath {
352
        base: PathBuf,
353
        sub_path: PathBuf,
354
    },
355

356
    InvalidDataProviderConfig,
357

358
    InvalidMachineLearningConfig,
359

360
    MachineLearningFeatureDataNotAvailable,
361
    MachineLearningFeaturesNotAvailable,
362
    MachineLearningModelNotFound,
363
    MachineLearningMustHaveAtLeastTwoFeatures,
364

365
    CouldNotCreateMlModelFilePath,
366
    CouldNotGetMlLabelKeyName,
367
    CouldNotGetMlModelDirectory,
368
    CouldNotGetMlModelFileName,
369
    CouldNotStoreMlModelInDb,
370
    InvalidMlModelPath,
371

372
    #[snafu(display("Valid filetypes: 'json'"))]
373
    NoValidMlModelFileType,
374

375
    #[cfg(feature = "pro")]
376
    #[snafu(context(false))]
377
    XGBoost {
378
        source: crate::pro::xg_error::XGBoostModuleError,
379
    },
380

381
    #[snafu(context(false))]
382
    PieChart {
383
        source: crate::plot::PieChartError,
384
    },
385

386
    #[snafu(display(
387
        "InvalidNumberOfTimeStepsError: expected \"{}\" found \"{}\"",
388
        expected,
389
        found
390
    ))]
391
    InvalidNumberOfTimeSteps {
392
        expected: usize,
393
        found: usize,
394
    },
395

396
    QueryingProcessorFailed {
397
        source: Box<dyn std::error::Error + Send + Sync>,
398
    },
399

400
    // TODO: wrap this somehow, because it's pro
401
    PermissionDenied,
402

403
    #[snafu(context(false))]
404
    #[snafu(display("LineSimplification error: {}", source))]
405
    LineSimplification {
406
        source: crate::processing::LineSimplificationError,
407
    },
408

409
    #[snafu(context(false))]
410
    #[snafu(display("RgbOperator error: {source}"))]
411
    RgbOperator {
412
        source: crate::processing::RgbOperatorError,
413
    },
414

415
    #[snafu(context(false))]
416
    #[snafu(display("Cache can't produce the promissed result error: {source}"))]
417
    CacheCantProduceResult {
418
        source: Box<dyn std::error::Error + Send + Sync>,
419
    },
420

421
    #[snafu(display("Input stream {stream_index} is not temporally aligned. Expected {expected:?}, found {found:?}."))]
422
    InputStreamsMustBeTemporallyAligned {
423
        stream_index: usize,
424
        expected: TimeInterval,
425
        found: TimeInterval,
426
    },
427

428
    AtLeastOneStreamRequired,
429

430
    #[snafu(display("Operator {operator:?} does not support sources with multiple bands."))]
431
    OperatorDoesNotSupportMultiBandsSourcesYet {
432
        operator: &'static str,
433
    },
434

435
    #[snafu(display("Operation {operation:?} does not support queries with multiple bands."))]
436
    OperationDoesNotSupportMultiBandQueriesYet {
437
        operation: &'static str,
438
    },
439

440
    RasterInputsMustHaveSameSpatialReferenceAndDatatype,
441

442
    GdalSourceDoesNotSupportQueryingOtherBandsThanTheFirstOneYet,
443

444
    #[snafu(display("Raster band names must be unique. Found {duplicate_key} more than once.",))]
445
    RasterBandNamesMustBeUnique {
446
        duplicate_key: String,
447
    },
448
    #[snafu(display("Raster band names must not be empty"))]
449
    RasterBandNameMustNotBeEmpty,
450
    #[snafu(display("Raster band names must not be longer than 256 bytes"))]
451
    RasterBandNameTooLong,
452

453
    AtLeastOneRasterBandDescriptorRequired,
454
}
455

456
impl From<crate::adapters::SparseTilesFillAdapterError> for Error {
457
    fn from(source: crate::adapters::SparseTilesFillAdapterError) -> Self {
×
458
        Error::SparseTilesFillAdapter { source }
×
459
    }
×
460
}
461

462
impl From<crate::mock::MockRasterSourceError> for Error {
463
    fn from(source: crate::mock::MockRasterSourceError) -> Self {
×
464
        Error::MockRasterSource { source }
×
465
    }
×
466
}
467

468
/// The error requires to be `Send`.
469
/// This inner modules tries to enforce this.
470
mod requirements {
471
    use super::*;
472

473
    trait RequiresSend: Send {}
474

475
    impl RequiresSend for Error {}
476
}
477

478
impl From<geoengine_datatypes::error::Error> for Error {
479
    fn from(datatype_error: geoengine_datatypes::error::Error) -> Self {
12✔
480
        Self::DataType {
12✔
481
            source: datatype_error,
12✔
482
        }
12✔
483
    }
12✔
484
}
485

486
impl From<gdal::errors::GdalError> for Error {
487
    fn from(gdal_error: gdal::errors::GdalError) -> Self {
595✔
488
        Self::Gdal { source: gdal_error }
595✔
489
    }
595✔
490
}
491

492
impl From<std::io::Error> for Error {
493
    fn from(io_error: std::io::Error) -> Self {
×
494
        Self::Io { source: io_error }
×
495
    }
×
496
}
497

498
impl From<serde_json::Error> for Error {
499
    fn from(serde_json_error: serde_json::Error) -> Self {
×
500
        Self::SerdeJson {
×
501
            source: serde_json_error,
×
502
        }
×
503
    }
×
504
}
505

506
impl From<arrow::error::ArrowError> for Error {
507
    fn from(source: arrow::error::ArrowError) -> Self {
×
508
        Error::Arrow { source }
×
509
    }
×
510
}
511

512
impl From<tokio::task::JoinError> for Error {
513
    fn from(source: tokio::task::JoinError) -> Self {
×
514
        Error::TokioJoin { source }
×
515
    }
×
516
}
517

518
impl From<crate::util::statistics::StatisticsError> for Error {
519
    fn from(source: StatisticsError) -> Self {
×
520
        Error::Statistics { source }
×
521
    }
×
522
}
523

524
impl From<ordered_float::FloatIsNan> for Error {
525
    fn from(source: FloatIsNan) -> Self {
×
526
        Error::InvalidNotNanFloatKey { source }
×
527
    }
×
528
}
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