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

getdozer / dozer / 5881075993

16 Aug 2023 03:58PM UTC coverage: 77.415% (-0.2%) from 77.649%
5881075993

push

github

web-flow
feat: replace jaeger with xray (#1862)

feat: replace jaeger with xray

23 of 23 new or added lines in 2 files covered. (100.0%)

46085 of 59530 relevant lines covered (77.41%)

55729.22 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::errors::internal::BoxedError;
22
use dozer_types::thiserror::Error;
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("Source validation failed")]
84
    SourceValidationError,
85
    #[error("Pipeline validation failed")]
86
    PipelineValidationError,
87
    #[error("Table name specified in endpoint not found: {0:?}")]
88
    EndpointTableNotFound(String),
89
    #[error("Duplicate table name found: {0:?}")]
90
    DuplicateTable(String),
91
    #[error("No endpoints initialized in the config provided")]
92
    EmptyEndpoints,
93
    #[error(transparent)]
94
    CloudContextError(#[from] CloudContextError),
95
    #[error("Failed to read organisation name. Error: {0}")]
96
    FailedToReadOrganisationName(#[source] io::Error),
97
    #[error(transparent)]
98
    LiveError(#[from] LiveError),
99
}
×
100

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

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

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

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

142
    #[error(transparent)]
143
    CloudCredentialError(#[from] CloudCredentialError),
144

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

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

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

154
    #[error(transparent)]
155
    ConfigCombineError(#[from] ConfigCombineError),
156

157
    #[error("Application not found")]
158
    ApplicationNotFound,
159
}
×
160

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

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

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

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

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

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

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

187
    #[error("SQL is not a string type")]
188
    SqlIsNotStringType,
189
}
×
190

191
#[derive(Debug, Error)]
×
192
pub enum BuildError {
193
    #[error("Endpoint {0} found in DAG but not in configuration file")]
194
    MissingEndpoint(String),
195
    #[error("Got mismatching primary key for `{endpoint_name}`. Expected: `{expected:?}`, got: `{actual:?}`")]
196
    MismatchPrimaryKey {
197
        endpoint_name: String,
198
        expected: Vec<String>,
199
        actual: Vec<String>,
200
    },
201
    #[error("Field not found at position {0}")]
202
    FieldNotFound(String),
203
    #[error("File system error {0:?}: {1}")]
204
    FileSystem(PathBuf, std::io::Error),
205
    #[error("Serde json error: {0}")]
206
    SerdeJson(#[from] serde_json::Error),
207
    #[error("Failed to generate proto files: {0:?}")]
208
    FailedToGenerateProtoFiles(#[from] GenerationError),
209
    #[error("Storage error: {0}")]
210
    Storage(#[from] storage::Error),
211
}
×
212

213
#[derive(Debug, Error)]
×
214
pub enum CloudLoginError {
215
    #[error("Tonic error: {0}")]
216
    TonicError(#[from] tonic::Status),
217

218
    #[error("Transport error: {0}")]
219
    Transport(#[from] tonic::transport::Error),
220

221
    #[error("HttpRequest error: {0}")]
222
    HttpRequestError(#[from] reqwest::Error),
223

224
    #[error(transparent)]
225
    SerializationError(#[from] dozer_types::serde_json::Error),
226

227
    #[error("Failed to read input: {0}")]
228
    InputError(#[from] std::io::Error),
229

230
    #[error(transparent)]
231
    CloudCredentialError(#[from] CloudCredentialError),
232

233
    #[error("Organisation not found")]
234
    OrganisationNotFound,
235
}
×
236

237
#[derive(Debug, Error)]
×
238
pub enum CloudCredentialError {
239
    #[error(transparent)]
240
    SerializationError(#[from] dozer_types::serde_yaml::Error),
241

242
    #[error(transparent)]
243
    JsonSerializationError(#[from] dozer_types::serde_json::Error),
244
    #[error("Failed to create home directory: {0}")]
245
    FailedToCreateDirectory(#[from] std::io::Error),
246

247
    #[error("HttpRequest error: {0}")]
248
    HttpRequestError(#[from] reqwest::Error),
249

250
    #[error("Missing credentials.yaml file - Please try to login again")]
251
    MissingCredentialFile,
252
    #[error("There's no profile with given name - Please try to login again")]
253
    MissingProfile,
254
}
×
255

256
#[derive(Debug, Error)]
×
257
pub enum CloudContextError {
258
    #[error("Failed to create access directory: {0}")]
259
    FailedToAccessDirectory(#[from] std::io::Error),
260

261
    #[error("Failed to get current directory path")]
262
    FailedToGetDirectoryPath,
263

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