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

geo-engine / geoengine / 3676601107

pending completion
3676601107

push

github

GitHub
Merge #695

42001 of 50014 relevant lines covered (83.98%)

2.01 hits per line

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

22.22
/operators/src/error.rs
1
use crate::util::statistics::StatisticsError;
2
use geoengine_datatypes::dataset::DataId;
3
use geoengine_datatypes::error::ErrorSource;
4
use geoengine_datatypes::primitives::FeatureDataType;
5
use snafu::prelude::*;
6
use std::ops::Range;
7
use std::path::PathBuf;
8

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

15
    InvalidMeteosatSatellite,
16

17
    InvalidUTCTimestamp,
18

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

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

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

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

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

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

56
    AllSourcesMustHaveSameSpatialReference,
57

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

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

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

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

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

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

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

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

102
    InvalidExpression,
103

104
    InvalidNumberOfExpressionInputs,
105

106
    InvalidNoDataValueValueForOutputDataType,
107

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

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

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

126
    #[snafu(display("Column types do not match: {:?} - {:?}", left, right))]
127
    ColumnTypeMismatch {
128
        left: FeatureDataType,
129
        right: FeatureDataType,
130
    },
131

132
    UnknownDataset {
133
        name: String,
134
        source: std::io::Error,
135
    },
136

137
    InvalidDatasetSpec {
138
        name: String,
139
        source: serde_json::Error,
140
    },
141

142
    WorkerThread {
143
        reason: String,
144
    },
145

146
    TimeIntervalColumnNameMissing,
147

148
    TimeIntervalDurationMissing,
149

150
    TimeParse {
151
        source: Box<dyn ErrorSource>,
152
    },
153

154
    TimeInstanceNotDisplayable,
155

156
    InvalidTimeStringPlaceholder {
157
        name: String,
158
    },
159

160
    DatasetMetaData {
161
        source: Box<dyn std::error::Error + Send + Sync>,
162
    },
163

164
    Arrow {
165
        source: arrow::error::ArrowError,
166
    },
167

168
    NoDataWithGivenId {
169
        id: DataId,
170
    },
171

172
    RasterRootPathNotConfigured, // TODO: remove when GdalSource uses LoadingInfo
173

174
    InvalidDataId,
175
    InvalidMetaDataType,
176
    UnknownDataId,
177

178
    // TODO: this error should not be propagated to user
179
    #[snafu(display("Could not open gdal dataset for file path {:?}", file_path))]
180
    CouldNotOpenGdalDataset {
181
        file_path: String,
182
    },
183

184
    FilePathNotRepresentableAsString,
185

186
    TokioJoin {
187
        source: tokio::task::JoinError,
188
    },
189

190
    OgrSourceColumnsSpecMissing,
191

192
    EmptyInput,
193

194
    OgrFieldValueIsNotDateTime,
195
    OgrFieldValueIsNotString,
196
    OgrFieldValueIsNotValidForTimestamp,
197
    OgrColumnFieldTypeMismatch {
198
        expected: String,
199
        field_value: gdal::vector::FieldValue,
200
    },
201

202
    FeatureDataValueMustNotBeNull,
203
    InvalidFeatureDataType,
204
    InvalidRasterDataType,
205

206
    #[snafu(display("No candidate source resolutions were produced."))]
207
    NoSourceResolution,
208

209
    WindowSizeMustNotBeZero,
210

211
    NotYetImplemented,
212

213
    TemporalRasterAggregationLastValidRequiresNoData,
214
    TemporalRasterAggregationFirstValidRequiresNoData,
215
    TemporalRasterAggregationMeanRequiresNoData,
216

217
    NoSpatialBoundsAvailable,
218

219
    ChannelSend,
220
    #[snafu(display("LoadingInfoError: {}", source))]
221
    LoadingInfo {
222
        source: Box<dyn std::error::Error + Send + Sync>,
223
    },
224

225
    NotImplemented,
226

227
    TileLimitExceeded {
228
        limit: usize,
229
    },
230

231
    FeatureDataNotAggregatable,
232

233
    FeatureDataLengthMismatch,
234

235
    OgrSqlQuery,
236

237
    GdalRasterDataTypeNotSupported,
238

239
    DynamicGdalSourceSpecHasEmptyTimePlaceholders,
240

241
    #[snafu(display("Input `{}` must be greater than zero at `{}`", name, scope))]
242
    InputMustBeGreaterThanZero {
243
        scope: &'static str,
244
        name: &'static str,
245
    },
246

247
    #[snafu(display("Input `{}` must be zero or positive at `{}`", name, scope))]
248
    InputMustBeZeroOrPositive {
249
        scope: &'static str,
250
        name: &'static str,
251
    },
252

253
    DuplicateOutputColumns,
254

255
    #[snafu(display("Input column `{:}` is missing", name))]
256
    MissingInputColumn {
257
        name: String,
258
    },
259

260
    InvalidGdalFilePath {
261
        file_path: PathBuf,
262
    },
263

264
    #[snafu(display(
265
        "Raster data sets with a different origin than upper left are currently not supported"
266
    ))]
267
    GeoTransformOrigin,
268

269
    #[snafu(display("Statistics error: {}", source))]
270
    Statistics {
271
        source: crate::util::statistics::StatisticsError,
272
    },
273

274
    #[snafu(display("SparseTilesFillAdapter error: {}", source))]
275
    SparseTilesFillAdapter {
276
        source: crate::adapters::SparseTilesFillAdapterError,
277
    },
278
    #[snafu(context(false))]
279
    ExpressionOperator {
280
        source: crate::processing::ExpressionError,
281
    },
282

283
    #[snafu(context(false))]
284
    TimeProjectionOperator {
285
        source: crate::processing::TimeProjectionError,
286
    },
287
    #[snafu(display("MockRasterSource error: {}", source))]
288
    MockRasterSource {
289
        source: crate::mock::MockRasterSourceError,
290
    },
291
    #[snafu(context(false))]
292
    InterpolationOperator {
293
        source: crate::processing::InterpolationError,
294
    },
295
    #[snafu(context(false))]
296
    TimeShift {
297
        source: crate::processing::TimeShiftError,
298
    },
299

300
    AlphaBandAsMaskNotAllowed,
301

302
    SpatialReferenceMustNotBeUnreferenced,
303

304
    #[snafu(context(false))]
305
    RasterKernelError {
306
        source: crate::processing::NeighborhoodAggregateError,
307
    },
308

309
    #[snafu(context(false))]
310
    GdalSource {
311
        source: crate::source::GdalSourceError,
312
    },
313

314
    QueryCanceled,
315

316
    AbortTriggerAlreadyUsed,
317

318
    SubPathMustNotEscapeBasePath {
319
        base: PathBuf,
320
        sub_path: PathBuf,
321
    },
322

323
    InvalidDataProviderConfig,
324

325
    InvalidMachineLearningConfig,
326

327
    MachineLearningModelNotFound,
328

329
    InvalidMlModelPath,
330
    CouldNotGetMlModelDirectory,
331

332
    #[cfg(feature = "xgboost")]
333
    #[snafu(context(false))]
334
    XGBoost {
335
        source: crate::pro::ml::xgboost::XGBoostModuleError,
336
    },
337

338
    #[snafu(display(
339
        "InvalidNumberOfTimeStepsError: expected \"{}\" found \"{}\"",
340
        expected,
341
        found
342
    ))]
343
    InvalidNumberOfTimeSteps {
344
        expected: usize,
345
        found: usize,
346
    },
347
}
348

349
impl From<crate::adapters::SparseTilesFillAdapterError> for Error {
350
    fn from(source: crate::adapters::SparseTilesFillAdapterError) -> Self {
×
351
        Error::SparseTilesFillAdapter { source }
352
    }
353
}
354

355
impl From<crate::mock::MockRasterSourceError> for Error {
356
    fn from(source: crate::mock::MockRasterSourceError) -> Self {
×
357
        Error::MockRasterSource { source }
358
    }
359
}
360

361
/// The error requires to be `Send`.
362
/// This inner modules tries to enforce this.
363
mod requirements {
364
    use super::*;
365

366
    trait RequiresSend: Send {}
367

368
    impl RequiresSend for Error {}
369
}
370

371
impl From<geoengine_datatypes::error::Error> for Error {
372
    fn from(datatype_error: geoengine_datatypes::error::Error) -> Self {
1✔
373
        Self::DataType {
374
            source: datatype_error,
375
        }
376
    }
377
}
378

379
impl From<gdal::errors::GdalError> for Error {
380
    fn from(gdal_error: gdal::errors::GdalError) -> Self {
2✔
381
        Self::Gdal { source: gdal_error }
382
    }
383
}
384

385
impl From<std::io::Error> for Error {
386
    fn from(io_error: std::io::Error) -> Self {
×
387
        Self::Io { source: io_error }
388
    }
389
}
390

391
impl From<serde_json::Error> for Error {
392
    fn from(serde_json_error: serde_json::Error) -> Self {
×
393
        Self::SerdeJson {
394
            source: serde_json_error,
395
        }
396
    }
397
}
398

399
impl From<arrow::error::ArrowError> for Error {
400
    fn from(source: arrow::error::ArrowError) -> Self {
×
401
        Error::Arrow { source }
402
    }
403
}
404

405
impl From<tokio::task::JoinError> for Error {
406
    fn from(source: tokio::task::JoinError) -> Self {
×
407
        Error::TokioJoin { source }
408
    }
409
}
410

411
impl From<crate::util::statistics::StatisticsError> for Error {
412
    fn from(source: StatisticsError) -> Self {
×
413
        Error::Statistics { source }
414
    }
415
}
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

© 2025 Coveralls, Inc