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

getdozer / dozer / 5780689709

pending completion
5780689709

push

github

web-flow
Remove s390x (#1827)

45527 of 59015 relevant lines covered (77.14%)

50795.91 hits per line

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

0.0
/dozer-cli/src/errors.rs
1
#![allow(clippy::enum_variant_names)]
2

3
use glob::{GlobError, PatternError};
4
use std::io;
5
use std::path::PathBuf;
6
use tonic::Code::NotFound;
7

8
use crate::errors::CloudError::{ApplicationNotFound, CloudServiceError};
9
use dozer_api::{
10
    errors::{ApiInitError, AuthError, GenerationError, GrpcError},
11
    rest::DOZER_SERVER_NAME_HEADER,
12
};
13
use dozer_cache::dozer_log::{errors::SchemaError, storage};
14
use dozer_cache::errors::CacheError;
15
use dozer_core::errors::ExecutionError;
16
use dozer_ingestion::errors::ConnectorError;
17
use dozer_sql::pipeline::errors::PipelineError;
18
use dozer_types::errors::internal::BoxedError;
19
use dozer_types::thiserror::Error;
20
use dozer_types::{serde_yaml, thiserror};
21

22
use crate::pipeline::connector_source::ConnectorSourceFactoryError;
23

24
pub fn map_tonic_error(e: tonic::Status) -> CloudError {
×
25
    if e.code() == NotFound && e.message() == "Failed to find app" {
×
26
        ApplicationNotFound
×
27
    } else {
×
28
        CloudServiceError(e)
×
29
    }
×
30
}
×
31

×
32
#[derive(Error, Debug)]
×
33
pub enum OrchestrationError {
×
34
    #[error("Failed to write config yaml: {0:?}")]
35
    FailedToWriteConfigYaml(#[source] serde_yaml::Error),
×
36
    #[error("File system error {0:?}: {1}")]
37
    FileSystem(PathBuf, std::io::Error),
38
    #[error("Failed to find build for endpoint {0}")]
39
    NoBuildFound(String),
40
    #[error("Failed to create log: {0}")]
41
    CreateLog(#[from] dozer_cache::dozer_log::replication::Error),
42
    #[error("Failed to login: {0}")]
43
    CloudLoginFailed(#[from] CloudLoginError),
44
    #[error("Credential Error: {0}")]
45
    CredentialError(#[from] CloudCredentialError),
46
    #[error("Failed to build: {0}")]
47
    BuildFailed(#[from] BuildError),
48
    #[error("Failed to generate token: {0}")]
49
    GenerateTokenFailed(#[source] AuthError),
50
    #[error("Missing api config or security input")]
51
    MissingSecurityConfig,
52
    #[error("Cloud service error: {0}")]
53
    CloudError(#[from] CloudError),
54
    #[error("Failed to initialize api server: {0}")]
55
    ApiInitFailed(#[from] ApiInitError),
56
    #[error("Failed to server API: {0}")]
57
    ApiServeFailed(#[source] std::io::Error),
58
    #[error("Failed to initialize internal server: {0}")]
59
    InternalServerFailed(#[source] GrpcError),
60
    #[error("{0}: Failed to initialize cache. Have you run `dozer build`?")]
61
    CacheInitFailed(#[source] CacheError),
62
    #[error("Failed to build cache {0} from log: {1}")]
63
    CacheBuildFailed(String, #[source] CacheError),
64
    #[error("Cache {0} has reached its maximum size. Try to increase `cache_max_map_size` in the config.")]
65
    CacheFull(String),
66
    #[error("Internal thread panic: {0}")]
67
    JoinError(#[source] tokio::task::JoinError),
68
    #[error("Connector source factory error: {0}")]
69
    ConnectorSourceFactory(#[from] ConnectorSourceFactoryError),
70
    #[error(transparent)]
71
    ExecutionError(#[from] ExecutionError),
72
    #[error(transparent)]
73
    ConnectorError(#[from] ConnectorError),
74
    #[error(transparent)]
75
    PipelineError(#[from] PipelineError),
76
    #[error(transparent)]
77
    CliError(#[from] CliError),
78
    #[error("Source validation failed")]
79
    SourceValidationError,
80
    #[error("Pipeline validation failed")]
81
    PipelineValidationError,
82
    #[error("Table name specified in endpoint not found: {0:?}")]
83
    EndpointTableNotFound(String),
84
    #[error("Duplicate table name found: {0:?}")]
85
    DuplicateTable(String),
86
    #[error("No endpoints initialized in the config provided")]
87
    EmptyEndpoints,
88
    #[error(transparent)]
89
    CloudContextError(#[from] CloudContextError),
90
    #[error("Failed to read organisation name. Error: {0}")]
91
    FailedToReadOrganisationName(#[source] io::Error),
92
}
93

94
#[derive(Error, Debug)]
×
95
pub enum CliError {
96
    #[error("Configuration file path not provided")]
97
    ConfigurationFilePathNotProvided,
98
    #[error("Can't find the configuration file(s) at: {0:?}")]
99
    FailedToFindConfigurationFiles(String),
×
100
    #[error("Unknown Command: {0:?}")]
101
    UnknownCommand(String),
102
    #[error("Failed to parse dozer config: {0:?}")]
103
    FailedToParseYaml(#[source] BoxedError),
104
    #[error("Failed to validate dozer config: {0:?}")]
105
    FailedToParseValidateYaml(#[source] BoxedError),
106
    #[error("Failed to read line: {0}")]
107
    ReadlineError(#[from] rustyline::error::ReadlineError),
108
    #[error("File system error {0:?}: {1}")]
109
    FileSystem(PathBuf, #[source] std::io::Error),
110
    #[error("Failed to create tokio runtime: {0}")]
111
    FailedToCreateTokioRuntime(#[source] std::io::Error),
112
    #[error("Reqwest error: {0}")]
113
    Reqwest(#[from] reqwest::Error),
114
    #[error(transparent)]
115
    ConfigCombineError(#[from] ConfigCombineError),
116
    #[error("Failed to serialize config to json: {0}")]
117
    SerializeConfigToJson(#[source] serde_json::Error),
118
    #[error("Missing config options to be overridden: {0}")]
119
    MissingConfigOverride(String),
120
    #[error("Failed to deserialize config from json: {0}")]
121
    DeserializeConfigFromJson(#[source] serde_json::Error),
122
}
123

124
#[derive(Error, Debug)]
×
125
pub enum CloudError {
126
    #[error("Connection failed. Error: {0:?}")]
127
    ConnectionToCloudServiceError(#[from] tonic::transport::Error),
128

129
    #[error("Cloud service returned error: {0:?}")]
×
130
    CloudServiceError(#[from] tonic::Status),
131

132
    #[error("GRPC request failed, error: {} (GRPC status {})", .0.message(), .0.code())]
133
    GRPCCallError(#[source] tonic::Status),
134

135
    #[error(transparent)]
136
    CloudCredentialError(#[from] CloudCredentialError),
137

138
    #[error("Reqwest error: {0}")]
139
    Reqwest(#[from] reqwest::Error),
140

141
    #[error("Response header {DOZER_SERVER_NAME_HEADER} is missing")]
142
    MissingResponseHeader,
143

144
    #[error(transparent)]
145
    CloudContextError(#[from] CloudContextError),
146

147
    #[error(transparent)]
148
    ConfigCombineError(#[from] ConfigCombineError),
149

150
    #[error("Application not found")]
151
    ApplicationNotFound,
152
}
153

154
#[derive(Debug, Error)]
×
155
pub enum ConfigCombineError {
156
    #[error("Failed to parse yaml file {0}: {1}")]
157
    ParseYaml(String, #[source] serde_yaml::Error),
158

159
    #[error("Cannot merge yaml value {from:?} to {to:?}")]
×
160
    CannotMerge {
161
        from: serde_yaml::Value,
162
        to: serde_yaml::Value,
163
    },
164

165
    #[error("Failed to parse config: {0}")]
166
    ParseConfig(#[source] serde_yaml::Error),
167

168
    #[error("Cannot read configuration: {0:?}")]
169
    CannotReadConfig(PathBuf, #[source] std::io::Error),
170

171
    #[error("Wrong pattern of config files read glob: {0}")]
172
    WrongPatternOfConfigFilesGlob(#[from] PatternError),
173

174
    #[error("Cannot read file: {0}")]
175
    CannotReadFile(#[from] GlobError),
176

177
    #[error("Cannot serialize config to string: {0}")]
178
    CannotSerializeToString(#[source] serde_yaml::Error),
179

180
    #[error("SQL is not a string type")]
181
    SqlIsNotStringType,
182
}
183

184
#[derive(Debug, Error)]
×
185
pub enum BuildError {
186
    #[error("Got mismatching primary key for `{endpoint_name}`. Expected: `{expected:?}`, got: `{actual:?}`")]
187
    MismatchPrimaryKey {
188
        endpoint_name: String,
189
        expected: Vec<String>,
×
190
        actual: Vec<String>,
191
    },
192
    #[error("Field not found at position {0}")]
193
    FieldNotFound(String),
194
    #[error("File system error {0:?}: {1}")]
195
    FileSystem(PathBuf, std::io::Error),
196
    #[error("Cannot load existing schema: {0}")]
197
    CannotLoadExistingSchema(#[source] SchemaError),
198
    #[error("Cannot write schema: {0}")]
199
    CannotWriteSchema(#[source] SchemaError),
200
    #[error("Failed to generate proto files: {0:?}")]
201
    FailedToGenerateProtoFiles(#[from] GenerationError),
202
    #[error("Storage error: {0}")]
203
    Storage(#[from] storage::Error),
204
}
205

206
#[derive(Debug, Error)]
×
207
pub enum CloudLoginError {
208
    #[error("Tonic error: {0}")]
209
    TonicError(#[from] tonic::Status),
210

211
    #[error("Transport error: {0}")]
×
212
    Transport(#[from] tonic::transport::Error),
213

214
    #[error("HttpRequest error: {0}")]
215
    HttpRequestError(#[from] reqwest::Error),
216

217
    #[error(transparent)]
218
    SerializationError(#[from] dozer_types::serde_json::Error),
219

220
    #[error("Failed to read input: {0}")]
221
    InputError(#[from] std::io::Error),
222

223
    #[error(transparent)]
224
    CloudCredentialError(#[from] CloudCredentialError),
225

226
    #[error("Organisation not found")]
227
    OrganisationNotFound,
228
}
229

230
#[derive(Debug, Error)]
×
231
pub enum CloudCredentialError {
232
    #[error(transparent)]
233
    SerializationError(#[from] dozer_types::serde_yaml::Error),
234

235
    #[error(transparent)]
×
236
    JsonSerializationError(#[from] dozer_types::serde_json::Error),
237
    #[error("Failed to create home directory: {0}")]
238
    FailedToCreateDirectory(#[from] std::io::Error),
239

240
    #[error("HttpRequest error: {0}")]
241
    HttpRequestError(#[from] reqwest::Error),
242

243
    #[error("Missing credentials.yaml file - Please try to login again")]
244
    MissingCredentialFile,
245
    #[error("There's no profile with given name - Please try to login again")]
246
    MissingProfile,
247
}
248

249
#[derive(Debug, Error)]
×
250
pub enum CloudContextError {
251
    #[error("Failed to create access directory: {0}")]
252
    FailedToAccessDirectory(#[from] std::io::Error),
253

254
    #[error("Failed to get current directory path")]
×
255
    FailedToGetDirectoryPath,
256

257
    #[error("App id not found in configuration. You need to run \"deploy\" or \"set-app\" first")]
258
    AppIdNotFound,
259
}
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