Skip to main content

scouter_sql/sql/
error.rs

1use scouter_dataframe::error::DataFrameError;
2use scouter_types::error::ProfileError;
3use scouter_types::error::RecordError;
4use sqlx::Error as SqlxError;
5use thiserror::Error;
6
7#[derive(Error, Debug)]
8pub enum SqlError {
9    #[error(transparent)]
10    SqlxError(#[from] SqlxError),
11
12    #[error("Failed to run migrations")]
13    MigrateError(#[from] sqlx::migrate::MigrateError),
14
15    #[error(transparent)]
16    RecordError(#[from] RecordError),
17
18    #[error(transparent)]
19    TypeError(#[from] scouter_types::error::TypeError),
20
21    #[error("Invalid record type: {0}")]
22    InvalidRecordTypeError(String),
23
24    #[error(transparent)]
25    SemverError(#[from] semver::Error),
26
27    #[error(transparent)]
28    VersionError(#[from] scouter_semver::error::VersionError),
29
30    #[error("Begin datetime must be before end datetime")]
31    InvalidDateRangeError,
32
33    #[error(transparent)]
34    DataFrameError(#[from] DataFrameError),
35
36    #[error(transparent)]
37    SerdeJsonError(#[from] serde_json::Error),
38
39    #[error(transparent)]
40    CronError(#[from] cron::error::Error),
41
42    #[error(transparent)]
43    UuidError(#[from] uuid::Error),
44
45    #[error("Failed to get next run for cron schedule")]
46    GetNextRunError,
47
48    #[error("Empty batch of records")]
49    EmptyBatchError,
50
51    #[error("Record batch type is not supported")]
52    UnsupportedBatchTypeError,
53
54    #[error(transparent)]
55    ProfileError(#[from] ProfileError),
56
57    #[error(transparent)]
58    OutOfRangeError(#[from] chrono::OutOfRangeError),
59
60    #[error("{0}")]
61    TraceCacheError(String),
62}