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

getdozer / dozer / 6011779781

29 Aug 2023 11:17AM UTC coverage: 76.528% (-1.5%) from 78.07%
6011779781

push

github

web-flow
fix: Include connection type in `GenerateDot`. Fix `AggregationProcessorFactory::type_name` (#1934)

170 of 170 new or added lines in 5 files covered. (100.0%)

49017 of 64051 relevant lines covered (76.53%)

48279.0 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::pipeline::errors::PipelineError;
21
use dozer_types::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("Cloud service error: {0}")]
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("Table name specified in endpoint not found: {0:?}")]
90
    EndpointTableNotFound(String),
91
    #[error("Duplicate table name found: {0:?}")]
92
    DuplicateTable(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
}
102

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

133
#[derive(Error, Debug)]
×
134
pub enum CloudError {
135
    #[error("Connection failed. Error: {0:?}")]
136
    ConnectionToCloudServiceError(#[from] tonic::transport::Error),
137

138
    #[error("Cloud service returned error: {0:?}")]
139
    CloudServiceError(#[from] tonic::Status),
140

141
    #[error("GRPC request failed, error: {} (GRPC status {})", .0.message(), .0.code())]
142
    GRPCCallError(#[source] tonic::Status),
143

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

147
    #[error("Reqwest error: {0}")]
148
    Reqwest(#[from] reqwest::Error),
149

150
    #[error("Response header {DOZER_SERVER_NAME_HEADER} is missing")]
151
    MissingResponseHeader,
152

153
    #[error(transparent)]
154
    CloudContextError(#[from] CloudContextError),
155

156
    #[error(transparent)]
157
    ConfigCombineError(#[from] ConfigCombineError),
158

159
    #[error("Application not found")]
160
    ApplicationNotFound,
161
}
162

163
#[derive(Debug, Error)]
×
164
pub enum ConfigCombineError {
×
165
    #[error("Failed to parse yaml file {0}: {1}")]
166
    ParseYaml(String, #[source] serde_yaml::Error),
167

168
    #[error("Cannot merge yaml value {from:?} to {to:?}")]
169
    CannotMerge {
170
        from: serde_yaml::Value,
171
        to: serde_yaml::Value,
172
    },
173

174
    #[error("Failed to parse config: {0}")]
175
    ParseConfig(#[source] serde_yaml::Error),
176

177
    #[error("Cannot read configuration: {0:?}")]
178
    CannotReadConfig(PathBuf, #[source] std::io::Error),
179

180
    #[error("Wrong pattern of config files read glob: {0}")]
181
    WrongPatternOfConfigFilesGlob(#[from] PatternError),
182

183
    #[error("Cannot read file: {0}")]
184
    CannotReadFile(#[from] GlobError),
185

186
    #[error("Cannot serialize config to string: {0}")]
187
    CannotSerializeToString(#[source] serde_yaml::Error),
188

189
    #[error("SQL is not a string type")]
190
    SqlIsNotStringType,
191
}
192

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

×
221
#[derive(Debug, Error)]
×
222
pub enum CloudLoginError {
×
223
    #[error("Tonic error: {0}")]
224
    TonicError(#[from] tonic::Status),
225

226
    #[error("Transport error: {0}")]
227
    Transport(#[from] tonic::transport::Error),
228

229
    #[error("HttpRequest error: {0}")]
230
    HttpRequestError(#[from] reqwest::Error),
231

232
    #[error(transparent)]
233
    SerializationError(#[from] dozer_types::serde_json::Error),
234

235
    #[error("Failed to read input: {0}")]
236
    InputError(#[from] std::io::Error),
237

238
    #[error(transparent)]
239
    CloudCredentialError(#[from] CloudCredentialError),
240

241
    #[error("Organisation not found")]
242
    OrganisationNotFound,
243
}
×
244

×
245
#[derive(Debug, Error)]
×
246
pub enum CloudCredentialError {
×
247
    #[error(transparent)]
248
    SerializationError(#[from] dozer_types::serde_yaml::Error),
249

250
    #[error(transparent)]
251
    JsonSerializationError(#[from] dozer_types::serde_json::Error),
252
    #[error("Failed to create home directory: {0}")]
253
    FailedToCreateDirectory(#[from] std::io::Error),
254

255
    #[error("HttpRequest error: {0}")]
256
    HttpRequestError(#[from] reqwest::Error),
257

258
    #[error("Missing credentials.yaml file - Please try to login again")]
259
    MissingCredentialFile,
260
    #[error("There's no profile with given name - Please try to login again")]
261
    MissingProfile,
262
}
×
263

×
264
#[derive(Debug, Error)]
×
265
pub enum CloudContextError {
×
266
    #[error("Failed to create access directory: {0}")]
267
    FailedToAccessDirectory(#[from] std::io::Error),
268

269
    #[error("Failed to get current directory path")]
270
    FailedToGetDirectoryPath,
271

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