Seismic Drive Client API
SDExceptionImpl.h
Go to the documentation of this file.
1 // ============================================================================
2 // Copyright 2017-2022, Schlumberger
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 // ============================================================================
16 
17 #pragma once
18 
19 #include "SDException.h"
20 #include "shared/config.h"
21 #include "shared/mex.h"
22 
23 #include <string>
24 
25 namespace seismicdrive
26 {
27  namespace error
28  {
29  namespace impl
30  {
31  class Root
32  {
33  public:
34  std::string what;
35 
36  protected:
37  Root(const std::string &what)
38  : what(what)
39  {
40  }
41  };
42  }
43 
44  namespace authprovider
45  {
46  class Error::Impl : public impl::Root
47  {
48  public:
49  Impl(const std::string &what)
50  : Root(what)
51  {
52  }
53  };
54  }
55 
56  namespace dataset
57  {
58  class Error::Impl : public impl::Root
59  {
60  public:
61  const std::string path;
62 
63  Impl(const std::string &what, const std::string &path)
64  : Root(what),
65  path(path)
66  {
67  }
68  };
69 
71  {
72  public:
73  Impl(const std::string &path)
74  : Error::Impl("Open failed\n"
75  "Dataset: " + path, path)
76  {
77  }
78  };
79 
81  {
82  public:
83  Impl(const std::string &path)
84  : Error::Impl("Delete failed\n"
85  "Dataset: " + path, path)
86  {
87  }
88  };
89 
91  {
92  public:
93  Impl(const std::string &path)
94  : Error::Impl("Flush failed\n"
95  "Dataset: " + path, path)
96  {
97  }
98  };
99 
100  class NotOpen::Impl : public Error::Impl
101  {
102  public:
103  Impl(const std::string &path)
104  : Error::Impl("Dataset is not open: " + path, path)
105  {
106  }
107  };
108 
110  {
111  public:
112  Impl(const std::string &path)
113  : Error::Impl("Dataset is already open: " + path, path)
114  {
115  }
116  };
117 
119  {
120  public:
121  Impl(const std::string &path, const std::string &field)
122  : Error::Impl("Field update failed"
123  "\nDataset: " + path +
124  "\nField: " + field, path),
125  field(field)
126  {
127  }
128 
129  const std::string field;
130  };
131 
133  {
134  public:
135  Impl(const std::string &path, const std::string &prefix = sdconfig::PATHPREFIX)
136  : Error::Impl("Invalid Seismic Store path: " + path +
137  "\nIt should start with " + prefix, path)
138  {
139  }
140  };
141 
143  {
144  public:
145  Impl(const std::string &path)
146  : Error::Impl("Invalid dataset path: " + path +
147  "\nExpected format: sd://<tenant_name>/<subproject_name>/<path>/<dataset_name>", path)
148  {
149  }
150  };
151 
153  {
154  public:
155  Impl(uint64_t nodeId)
156  : Error::Impl("Invalid node ID: " + std::to_string(nodeId), ""),
157  nodeId(nodeId)
158  {
159  }
160 
161  const uint64_t nodeId;
162  };
163 
164  class Locked::Impl : public Error::Impl
165  {
166  public:
167  Impl(const std::string &what, const std::string &path)
168  : Error::Impl({what, path})
169  {
170  }
171  };
172 
173  namespace context
174  {
176  {
177  public:
178  Impl(const std::string &path)
179  : Error::Impl("Dataset must be read-only: " + path, path)
180  {
181  }
182  };
183 
184  class Expired::Impl : public Error::Impl
185  {
186  public:
187  Impl(const std::string &path)
188  : Error::Impl("Context expired\n"
189  "Dataset: " + path, path)
190  {
191  }
192  };
193 
195  {
196  public:
197  Impl(const std::string &path)
198  : Error::Impl("Unknown context format\n"
199  "Dataset: " + path, path)
200  {
201  }
202  };
203 
205  {
206  public:
207  Impl(const std::string &path, const std::string &contextPath)
208  : Error::Impl("Dataset path does not match context"
209  "\nDataset: " + path +
210  "\nContext: " + contextPath, path),
212  {
213  }
214 
215  const std::string contextPath;
216  };
217  }
218  }
219 
220  namespace format
221  {
222  class Error::Impl : public impl::Root
223  {
224  public:
225  Impl(const std::string &what)
226  : Root(what)
227  {
228  }
229  };
230 
231  class Json::Impl : public Error::Impl
232  {
233  public:
234  Impl(const std::string &what)
235  : Error::Impl(what)
236  {
237  }
238  };
239 
240  class ToJson::Impl : public Json::Impl
241  {
242  public:
243  Impl(const std::string &what)
244  : Json::Impl(what)
245  {
246  }
247  };
248 
249  class FromJson::Impl : public Json::Impl
250  {
251  public:
252  Impl(const std::string &what, const std::string &variable)
253  : Json::Impl(what),
255  {
256  }
257 
258  const std::string variable;
259  };
260  }
261 
262  namespace internal
263  {
264  class Error::Impl : public impl::Root
265  {
266  public:
267  Impl(const std::string &what)
268  : Root(what)
269  {
270  }
271  };
272  }
273 
275  {
276  public:
277  Impl(const std::string &what)
278  : Root(what)
279  {
280  }
281  };
282 
283  namespace manager
284  {
286  {
287  public:
288  Impl(const std::string &what)
289  : Exception::Impl(what)
290  {
291  }
292  };
293 
295  {
296  public:
297  Impl(int)
298  : Error::Impl(sdmex::sdmanager::AuthProviderNotSet())
299  {
300  }
301  };
302 
304  {
305  public:
306  Impl(int)
307  : Error::Impl(sdmex::sdmanager::AuthProviderTypeChange())
308  {
309  }
310  };
311 
312  namespace context
313  {
315  {
316  public:
317  Impl(int)
318  : Error::Impl(sdmex::sdmanager::SerializeFailed())
319  {
320  }
321  };
322  }
323 
325  {
326  public:
327  Impl(int)
328  : Error::Impl(sdmex::sdmanager::ServiceUrlNotSet())
329  {
330  }
331  };
332 
334  {
335  public:
336  Impl(int)
337  : Error::Impl(sdmex::sdmanager::ApiKeyNotSet())
338  {
339  }
340  };
341  }
342 
343  namespace seismicstore
344  {
346  {
347  public:
348  Impl(const std::string &what)
349  : Root(what)
350  {
351  }
352  };
353 
354  class NotJson::Impl : public impl::Root
355  {
356  public:
357  Impl(const std::string &what)
358  : Root(what)
359  {
360  }
361  };
362  }
363 
364  namespace storage
365  {
366  class Error::Impl : public impl::Root
367  {
368  public:
369  Impl(const std::string &what)
370  : Root(what)
371  {
372  }
373  };
374 
376  {
377  public:
378  Impl(const std::string &s)
379  : Error::Impl("Not implemented: " + s),
380  notImplemented(s)
381  {
382  }
383 
384  const std::string notImplemented;
385  };
386 
388  {
389  public:
390  Impl(int)
391  : Error::Impl("Invalid sas uri")
392  {
393  }
394  };
395 
397  {
398  public:
399  Impl(const std::string &what)
400  : Root(what)
401  {
402  }
403  };
404 
406  {
407  public:
408  Impl(const std::string &what)
409  : Error::Impl(what)
410  {
411  }
412  };
413 
415  {
416  public:
417  Impl(const std::string &what)
418  : ProviderError::Impl(what + " support was not included when this sdapi was built"),
419  notBuilt(what + " support")
420  {
421  }
422 
423  const std::string notBuilt;
424  };
425  }
426  }
427 }
Impl(const std::string &path)
Definition: SDExceptionImpl.h:93
const std::string path
Definition: SDExceptionImpl.h:61
Impl(const std::string &what)
Definition: SDExceptionImpl.h:243
const std::string notImplemented
Definition: SDExceptionImpl.h:384
Impl(const std::string &path)
Definition: SDExceptionImpl.h:73
Definition: SDException.h:966
Impl(const std::string &what)
Definition: SDExceptionImpl.h:267
Impl(const std::string &path)
Definition: SDExceptionImpl.h:187
Impl(const std::string &what)
Definition: SDExceptionImpl.h:225
Definition: SDExceptionImpl.h:164
Impl(const std::string &path)
Definition: SDExceptionImpl.h:112
Impl(const std::string &what)
Definition: SDExceptionImpl.h:357
Definition: SDExceptionImpl.h:414
Definition: SDExceptionImpl.h:274
Impl(const std::string &what, const std::string &path)
Definition: SDExceptionImpl.h:63
Definition: SDExceptionImpl.h:264
Definition: SDException.h:645
Definition: SDExceptionImpl.h:109
Impl(const std::string &what)
Definition: SDExceptionImpl.h:399
Definition: SDExceptionImpl.h:90
Impl(const std::string &what)
Definition: SDExceptionImpl.h:417
std::string what
Definition: SDExceptionImpl.h:34
Impl(const std::string &s)
Definition: SDExceptionImpl.h:378
Impl(const std::string &path, const std::string &field)
Definition: SDExceptionImpl.h:121
Definition: SDExceptionImpl.h:80
const uint64_t nodeId
Definition: SDExceptionImpl.h:161
Impl(const std::string &path)
Definition: SDExceptionImpl.h:83
Definition: SDExceptionImpl.h:222
Impl(const std::string &what)
Definition: SDExceptionImpl.h:369
Impl(int)
Definition: SDExceptionImpl.h:297
Impl(int)
Definition: SDExceptionImpl.h:336
Definition: SDExceptionImpl.h:70
Impl(const std::string &what)
Definition: SDExceptionImpl.h:277
const std::string contextPath
Definition: SDExceptionImpl.h:215
Impl(int)
Definition: SDExceptionImpl.h:327
Impl(const std::string &what, const std::string &path)
Definition: SDExceptionImpl.h:167
Definition: SDExceptionImpl.h:31
Definition: SDException.h:721
Definition: SDExceptionImpl.h:118
Definition: SDException.h:892
Impl(const std::string &path)
Definition: SDExceptionImpl.h:103
Definition: SDExceptionImpl.h:58
Definition: SDException.h:627
Definition: SDExceptionImpl.h:387
const std::string variable
Definition: SDExceptionImpl.h:258
Definition: SDExceptionImpl.h:396
Definition: SDExceptionImpl.h:354
Impl(int)
Definition: SDExceptionImpl.h:390
Definition: SDExceptionImpl.h:46
Impl(const std::string &path)
Definition: SDExceptionImpl.h:197
Impl(uint64_t nodeId)
Definition: SDExceptionImpl.h:155
Impl(const std::string &path)
Definition: SDExceptionImpl.h:178
Definition: SDExceptionImpl.h:285
Definition: SDException.h:832
Definition: SDExceptionImpl.h:100
Impl(const std::string &path)
Definition: SDExceptionImpl.h:145
Definition: SDExceptionImpl.h:142
Definition: SDExceptionImpl.h:231
Definition: SDExceptionImpl.h:405
Impl(const std::string &path, const std::string &contextPath)
Definition: SDExceptionImpl.h:207
Definition: Constants.h:27
Definition: SDExceptionImpl.h:249
Root(const std::string &what)
Definition: SDExceptionImpl.h:37
Definition: SDExceptionImpl.h:132
Impl(const std::string &what)
Definition: SDExceptionImpl.h:234
Impl(const std::string &what)
Definition: SDExceptionImpl.h:288
Definition: SDExceptionImpl.h:366
Definition: SDExceptionImpl.h:152
Impl(const std::string &what)
Definition: SDExceptionImpl.h:49
Impl(const std::string &what, const std::string &variable)
Definition: SDExceptionImpl.h:252
const std::string field
Definition: SDExceptionImpl.h:129
Definition: SDException.h:740
Impl(const std::string &what)
Definition: SDExceptionImpl.h:348
Impl(const std::string &what)
Definition: SDExceptionImpl.h:408
const std::string notBuilt
Definition: SDExceptionImpl.h:423
Definition: SDExceptionImpl.h:333
Impl(const std::string &path, const std::string &prefix=sdconfig::PATHPREFIX)
Definition: SDExceptionImpl.h:135
Definition: SDExceptionImpl.h:240
Definition: SDException.h:234