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

getdozer / dozer / 6299724219

25 Sep 2023 12:58PM UTC coverage: 77.81% (+0.5%) from 77.275%
6299724219

push

github

chubei
fix: Add `BINDGEN_EXTRA_CLANG_ARGS` to cross compile rocksdb

50223 of 64546 relevant lines covered (77.81%)

148909.49 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::{
9
    errors::CloudError::{ApplicationNotFound, CloudServiceError},
10
    live::LiveError,
11
};
12
use dozer_api::{
13
    errors::{ApiInitError, AuthError, GenerationError, GrpcError},
14
    rest::DOZER_SERVER_NAME_HEADER,
15
};
16
use dozer_cache::dozer_log::storage;
17
use dozer_cache::errors::CacheError;
18
use dozer_core::errors::ExecutionError;
19
use dozer_ingestion::errors::ConnectorError;
20
use dozer_sql::errors::PipelineError;
21
use dozer_types::{constants::LOCK_FILE, thiserror::Error};
22
use dozer_types::{errors::internal::BoxedError, serde_json};
23
use dozer_types::{serde_yaml, thiserror};
24

25
use crate::pipeline::connector_source::ConnectorSourceFactoryError;
26

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

35
#[derive(Error, Debug)]
×
36
pub enum OrchestrationError {
37
    #[error("Failed to write config yaml: {0:?}")]
38
    FailedToWriteConfigYaml(#[source] serde_yaml::Error),
39
    #[error("File system error {0:?}: {1}")]
40
    FileSystem(PathBuf, std::io::Error),
41
    #[error("Failed to find any build")]
42
    NoBuildFound,
43
    #[error("Failed to create log: {0}")]
44
    CreateLog(#[from] dozer_cache::dozer_log::replication::Error),
45
    #[error("Failed to login: {0}")]
46
    CloudLoginFailed(#[from] CloudLoginError),
47
    #[error("Credential Error: {0}")]
48
    CredentialError(#[from] CloudCredentialError),
49
    #[error("Failed to build: {0}")]
50
    BuildFailed(#[from] BuildError),
51
    #[error("Failed to generate token: {0}")]
52
    GenerateTokenFailed(#[source] AuthError),
53
    #[error("Missing api config or security input")]
54
    MissingSecurityConfig,
55
    #[error(transparent)]
56
    CloudError(#[from] CloudError),
57
    #[error("Failed to initialize api server: {0}")]
58
    ApiInitFailed(#[from] ApiInitError),
59
    #[error("Failed to server REST API: {0}")]
60
    RestServeFailed(#[source] std::io::Error),
61
    #[error("Failed to server gRPC API: {0:?}")]
62
    GrpcServeFailed(#[source] tonic::transport::Error),
63
    #[error("Failed to initialize internal server: {0}")]
64
    InternalServerFailed(#[source] GrpcError),
65
    #[error("{0}: Failed to initialize cache. Have you run `dozer build`?")]
66
    CacheInitFailed(#[source] CacheError),
67
    #[error("Failed to build cache {0} from log: {1}")]
68
    CacheBuildFailed(String, #[source] CacheError),
69
    #[error("Cache {0} has reached its maximum size. Try to increase `cache_max_map_size` in the config.")]
70
    CacheFull(String),
71
    #[error("Internal thread panic: {0}")]
72
    JoinError(#[source] tokio::task::JoinError),
73
    #[error("Connector source factory error: {0}")]
74
    ConnectorSourceFactory(#[from] ConnectorSourceFactoryError),
75
    #[error(transparent)]
76
    ExecutionError(#[from] ExecutionError),
77
    #[error(transparent)]
78
    ConnectorError(#[from] ConnectorError),
79
    #[error(transparent)]
80
    PipelineError(#[from] PipelineError),
81
    #[error(transparent)]
82
    CliError(#[from] CliError),
83
    #[error("table_name: {0:?} not found in any of the connections")]
84
    SourceValidationError(String),
85
    #[error("connection: {0:?} not found")]
86
    ConnectionNotFound(String),
87
    #[error("Pipeline validation failed")]
88
    PipelineValidationError,
89
    #[error("Output table {0} not used in any endpoint")]
90
    OutputTableNotUsed(String),
91
    #[error("Table name specified in endpoint not found: {0:?}")]
92
    EndpointTableNotFound(String),
93
    #[error("No endpoints initialized in the config provided")]
94
    EmptyEndpoints,
95
    #[error(transparent)]
96
    CloudContextError(#[from] CloudContextError),
97
    #[error("Failed to read organisation name. Error: {0}")]
98
    FailedToReadOrganisationName(#[source] io::Error),
99
    #[error(transparent)]
100
    LiveError(#[from] LiveError),
101
    #[error("{LOCK_FILE} is out of date")]
102
    LockedOutdatedLockfile,
103
    #[error("{LOCK_FILE} does not exist. `--locked` requires a lock file.")]
104
    LockedNoLockFile,
105
}
106

107
#[derive(Error, Debug)]
×
108
pub enum CliError {
109
    #[error("Configuration file path not provided")]
110
    ConfigurationFilePathNotProvided,
111
    #[error("Can't find the configuration file(s) at: {0:?}")]
112
    FailedToFindConfigurationFiles(String),
113
    #[error("Unknown Command: {0:?}")]
114
    UnknownCommand(String),
115
    #[error("Failed to parse dozer config: {0:?}")]
116
    FailedToParseYaml(#[source] BoxedError),
117
    #[error("Failed to validate dozer config: {0:?}")]
118
    FailedToParseValidateYaml(#[source] BoxedError),
119
    #[error("Failed to read line: {0}")]
120
    ReadlineError(#[from] rustyline::error::ReadlineError),
121
    #[error("File system error {0:?}: {1}")]
122
    FileSystem(PathBuf, #[source] std::io::Error),
123
    #[error("Failed to create tokio runtime: {0}")]
124
    FailedToCreateTokioRuntime(#[source] std::io::Error),
125
    #[error("Reqwest error: {0}")]
126
    Reqwest(#[from] reqwest::Error),
127
    #[error(transparent)]
128
    ConfigCombineError(#[from] ConfigCombineError),
129
    #[error("Failed to serialize config to json: {0}")]
130
    SerializeConfigToJson(#[source] serde_json::Error),
131
    #[error("Missing config options to be overridden: {0}")]
132
    MissingConfigOverride(String),
133
    #[error("Failed to deserialize config from json: {0}")]
134
    DeserializeConfigFromJson(#[source] serde_json::Error),
135
    // Generic IO error
136
    #[error(transparent)]
137
    Io(#[from] std::io::Error),
138
}
139

140
#[derive(Error, Debug)]
×
141
pub enum CloudError {
142
    #[error("Connection failed. Error: {0:?}")]
143
    ConnectionToCloudServiceError(#[from] tonic::transport::Error),
144

145
    #[error("Cloud service returned error: {}", .0.message())]
146
    CloudServiceError(#[from] tonic::Status),
147

148
    #[error("GRPC request failed, error: {} (GRPC status {})", .0.message(), .0.code())]
149
    GRPCCallError(#[source] tonic::Status),
150

151
    #[error(transparent)]
152
    CloudCredentialError(#[from] CloudCredentialError),
153

154
    #[error("Reqwest error: {0}")]
155
    Reqwest(#[from] reqwest::Error),
156

157
    #[error("Response header {DOZER_SERVER_NAME_HEADER} is missing")]
158
    MissingResponseHeader,
159

160
    #[error(transparent)]
161
    CloudContextError(#[from] CloudContextError),
162

163
    #[error(transparent)]
164
    ConfigCombineError(#[from] ConfigCombineError),
165

166
    #[error("Application not found")]
167
    ApplicationNotFound,
168

169
    #[error("{LOCK_FILE} not found. Run `dozer build` before deploying, or pass '--no-lock'.")]
170
    LockfileNotFound,
171
}
172

173
#[derive(Debug, Error)]
×
174
pub enum ConfigCombineError {
×
175
    #[error("Failed to parse yaml file {0}: {1}")]
176
    ParseYaml(String, #[source] serde_yaml::Error),
177

178
    #[error("Cannot merge yaml value {from:?} to {to:?}")]
179
    CannotMerge {
180
        from: serde_yaml::Value,
181
        to: serde_yaml::Value,
182
    },
183

184
    #[error("Failed to parse config: {0}")]
185
    ParseConfig(#[source] serde_yaml::Error),
186

187
    #[error("Cannot read configuration: {0:?}")]
188
    CannotReadConfig(PathBuf, #[source] std::io::Error),
189

190
    #[error("Wrong pattern of config files read glob: {0}")]
191
    WrongPatternOfConfigFilesGlob(#[from] PatternError),
192

193
    #[error("Cannot read file: {0}")]
194
    CannotReadFile(#[from] GlobError),
195

196
    #[error("Cannot serialize config to string: {0}")]
197
    CannotSerializeToString(#[source] serde_yaml::Error),
198

199
    #[error("SQL is not a string type")]
200
    SqlIsNotStringType,
201
}
202

203
#[derive(Debug, Error)]
×
204
pub enum BuildError {
×
205
    #[error("Endpoint {0} not found in DAG")]
206
    MissingEndpoint(String),
207
    #[error("Connection {0} found in DAG but not in config")]
208
    MissingConnection(String),
209
    #[error("Got mismatching primary key for `{endpoint_name}`. Expected: `{expected:?}`, got: `{actual:?}`")]
210
    MismatchPrimaryKey {
211
        endpoint_name: String,
212
        expected: Vec<String>,
213
        actual: Vec<String>,
214
    },
215
    #[error("Field not found at position {0}")]
216
    FieldNotFound(String),
217
    #[error("File system error {0:?}: {1}")]
218
    FileSystem(PathBuf, std::io::Error),
219
    #[error(
220
        "Failed to load existing contract: {0}. You have to run a force build: `dozer build --force`."
221
    )]
222
    FailedToLoadExistingContract(#[source] serde_json::Error),
223
    #[error("Serde json error: {0}")]
224
    SerdeJson(#[source] serde_json::Error),
225
    #[error("Failed to generate proto files: {0:?}")]
226
    FailedToGenerateProtoFiles(#[from] GenerationError),
227
    #[error("Storage error: {0}")]
228
    Storage(#[from] storage::Error),
229
}
230

231
#[derive(Debug, Error)]
×
232
pub enum CloudLoginError {
×
233
    #[error("Tonic error: {0}")]
234
    TonicError(#[from] tonic::Status),
235

236
    #[error("Transport error: {0}")]
237
    Transport(#[from] tonic::transport::Error),
238

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

242
    #[error(transparent)]
243
    SerializationError(#[from] dozer_types::serde_json::Error),
244

245
    #[error("Failed to read input: {0}")]
246
    InputError(#[from] std::io::Error),
247

248
    #[error(transparent)]
249
    CloudCredentialError(#[from] CloudCredentialError),
250

251
    #[error("Organisation not found")]
252
    OrganisationNotFound,
253
}
254

255
#[derive(Debug, Error)]
×
256
pub enum CloudCredentialError {
×
257
    #[error(transparent)]
258
    SerializationError(#[from] dozer_types::serde_yaml::Error),
259

260
    #[error(transparent)]
261
    JsonSerializationError(#[from] dozer_types::serde_json::Error),
262
    #[error("Failed to create home directory: {0}")]
263
    FailedToCreateDirectory(#[from] std::io::Error),
264

265
    #[error("HttpRequest error: {0}")]
266
    HttpRequestError(#[from] reqwest::Error),
267

268
    #[error("Missing credentials.yaml file - Please try to login again")]
269
    MissingCredentialFile,
270
    #[error("There's no profile with given name - Please try to login again")]
271
    MissingProfile,
272
}
273

274
#[derive(Debug, Error)]
×
275
pub enum CloudContextError {
×
276
    #[error("Failed to create access directory: {0}")]
277
    FailedToAccessDirectory(#[from] std::io::Error),
278

279
    #[error("Failed to get current directory path")]
280
    FailedToGetDirectoryPath,
281

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