Seismic Drive Client API
SDException.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 "DLL_EXPORT.h"
20 
21 #include <cstdint>
22 #include <limits>
23 #include <memory>
24 #include <stdexcept>
25 
26 namespace seismicdrive
27 {
28 
29  #ifdef _MSC_VER
30  #pragma warning(push)
31  #pragma warning(disable : 4275)
32  #endif
33 
37  struct DLL_PUBLIC SDException : public std::runtime_error
38  {
39  protected:
40  SDException(const std::string what);
41  };
42 
43  #ifdef _MSC_VER
44  #pragma warning(pop)
45  #pragma warning(push)
46  #pragma warning(disable : 4251 4996)
47  #endif
48 
52  struct DLL_PUBLIC DEPRECATED("Catch error::format::Json instead") SDExceptionValueError : public SDException
53  {
54  protected:
55  SDExceptionValueError(std::string what);
56  };
57 
61  struct DLL_PUBLIC DEPRECATED("Catch error::authprovider::Error instead") SDExceptionAuthProviderError : public SDException
62  {
63  protected:
64  SDExceptionAuthProviderError(std::string what);
65  };
66 
70  struct DLL_PUBLIC DEPRECATED("Catch error::seismicstore::ActionFailed instead") SDExceptionSDAccessorError : public SDException
71  {
72  protected:
73  SDExceptionSDAccessorError(std::string what);
74  };
75 
79  struct DLL_PUBLIC DEPRECATED("Catch error::storage::AccessError instead") SDExceptionGCSAccessorError : public SDException
80  {
81  protected:
82  SDExceptionGCSAccessorError(std::string what);
83  };
84 
88  struct DLL_PUBLIC DEPRECATED("Catch error::dataset::Error instead") SDExceptionDatasetError : public SDException
89  {
90  protected:
91  SDExceptionDatasetError(std::string what);
92  };
93 
97  struct DLL_PUBLIC DEPRECATED("Catch error::dataset::context::Expired instead") SDExceptionContextExpired : public SDException
98  {
99  protected:
100  SDExceptionContextExpired(std::string what);
101  };
102 
106  struct DLL_PUBLIC DEPRECATED("Catch error::dataset::context::UnknownFormat instead") SDExceptionContextVersionTooNew : public SDException
107  {
108  protected:
109  SDExceptionContextVersionTooNew(std::string what);
110  };
111 
115  struct DLL_PUBLIC DEPRECATED("Catch error::dataset::context::PathMismatch instead") SDExceptionContextPathNoMatch : public SDException
116  {
117  protected:
118  SDExceptionContextPathNoMatch(std::string what);
119  };
120 
124  struct DLL_PUBLIC DEPRECATED("Catch error::storage::Error instead") SDExceptionStorageError : public SDException
125  {
126  protected:
127  SDExceptionStorageError(std::string what);
128  };
129 
133  struct DLL_PUBLIC DEPRECATED("Catch error::storage::Error instead") SDExceptionAzureStorageError : public SDExceptionStorageError
134  {
135  SDExceptionAzureStorageError(std::string what);
136  };
137 
141  struct DLL_PUBLIC DEPRECATED("Catch error::internal::Error instead") SDExceptionInternalError : public SDException
142  {
143  protected:
144  SDExceptionInternalError(std::string what);
145  };
146 
150  struct DLL_PUBLIC DEPRECATED("Not thrown by the SDAPI") SDExceptionOutdatedMethod : public SDException
151  {
152  private:
153  SDExceptionOutdatedMethod(std::string what);
154  };
155 
159  struct DLL_PUBLIC DEPRECATED("Catch error::seismicstore::NotJson instead") SDExpectedJsonException : public SDException
160  {
161  protected:
162  SDExpectedJsonException(std::string what);
163  };
164 
165 
169  struct DLL_PUBLIC DEPRECATED("Catch error::dataset::context::NotReadOnly instead") SDExpectedReadOnlyDatasetException : public SDException
170  {
171  protected:
172  SDExpectedReadOnlyDatasetException(std::string what);
173  };
174 
178  class DLL_PUBLIC DEPRECATED("Catch error::dataset::Locked instead") SDExceptionDatasetLocked : public SDException
179  {
180  public:
181  enum Reason
182  {
183  UNKNOWN = 0,
184  WRITE_LOCKED = 1,
185  READ_LOCKED = 2,
186  CANNOT_LOCK = 3,
187  CANNOT_UNLOCK = 4
188  };
189 
190  Reason const &reason() const { return mReason; }
191 
192  std::uint32_t get_estimated_lock_lease_seconds() const { return mTimeToLiveSeconds; }
193 
194  protected:
195  SDExceptionDatasetLocked(std::string const &what);
196 
197  SDExceptionDatasetLocked(std::string const &what,
198  Reason reason,
199  std::uint32_t ttl = (std::numeric_limits<std::uint32_t>::max)()); //For more info on wrapping max with parenthesis please refer to https://stackoverflow.com/questions/11544073/how-do-i-deal-with-the-max-macro-in-windows-h-colliding-with-max-in-std
200 
201  Reason mReason;
202 
203  std::uint32_t mTimeToLiveSeconds;
204  };
205 
206  namespace error
207  {
208  namespace authprovider
209  {
213  class DLL_PUBLIC Error : public SDExceptionAuthProviderError
214  {
215  public:
216  class Impl;
217 
218  Error(const Impl &impl);
219 
220  ~Error();
221 
222  protected:
223  Error(Impl *impl);
224 
225  std::shared_ptr<Impl> impl;
226  };
227  }
228 
229  namespace dataset
230  {
234  class DLL_PUBLIC Error : public SDExceptionDatasetError
235  {
236  public:
240  std::string getPath();
241 
242  class Impl;
243 
244  Error(const Impl &impl);
245 
246  ~Error();
247 
248  protected:
249  Error(Impl *impl);
250 
251  std::shared_ptr<Impl> impl;
252  };
253 
257  class DLL_PUBLIC OpenFailed : public Error
258  {
259  public:
263  std::string getPath();
264 
265  class Impl;
266 
267  OpenFailed(const Impl &impl);
268 
269  ~OpenFailed();
270 
271  protected:
272  OpenFailed(Impl *impl);
273 
275  };
276 
280  class DLL_PUBLIC DeleteFailed : public Error
281  {
282  public:
286  std::string getPath();
287 
288  class Impl;
289 
290  DeleteFailed(const Impl &impl);
291 
292  ~DeleteFailed();
293 
294  protected:
295  DeleteFailed(Impl *impl);
296 
298  };
299 
303  class DLL_PUBLIC FlushFailed : public Error
304  {
305  public:
309  std::string getPath();
310 
311  class Impl;
312 
313  FlushFailed(const Impl &impl);
314 
315  ~FlushFailed();
316 
317  protected:
318  FlushFailed(Impl *impl);
319 
321  };
322 
326  class DLL_PUBLIC NotOpen : public Error
327  {
328  public:
332  std::string getPath();
333 
334  class Impl;
335 
336  NotOpen(const Impl &impl);
337 
338  ~NotOpen();
339 
340  protected:
341  NotOpen(Impl *impl);
342 
344  };
345 
349  class DLL_PUBLIC AlreadyOpen : public Error
350  {
351  public:
355  std::string getPath();
356 
357  class Impl;
358 
359  AlreadyOpen(const Impl &impl);
360 
361  ~AlreadyOpen();
362 
363  protected:
364  AlreadyOpen(Impl *impl);
365 
367  };
368 
372  class DLL_PUBLIC UpdateFailed : public Error
373  {
374  public:
378  std::string getPath();
379 
383  std::string getField();
384 
385  class Impl;
386 
387  UpdateFailed(const Impl &impl);
388 
389  ~UpdateFailed();
390 
391  protected:
392  UpdateFailed(Impl *impl);
393 
395  };
396 
400  class DLL_PUBLIC InvalidPrefix : public Error
401  {
402  public:
406  std::string getPath();
407 
408  class Impl;
409 
410  InvalidPrefix(const Impl &impl);
411 
412  ~InvalidPrefix();
413 
414  protected:
415  InvalidPrefix(Impl *impl);
416 
418  };
419 
423  class DLL_PUBLIC InvalidPath : public Error
424  {
425  public:
429  std::string getPath();
430 
431  class Impl;
432 
433  InvalidPath(const Impl &impl);
434 
435  ~InvalidPath();
436 
437  protected:
438  InvalidPath(Impl *impl);
439 
441  };
442 
446  class DLL_PUBLIC InvalidNodeId : public Error
447  {
448  public:
452  uint64_t getNodeId();
453 
454  class Impl;
455 
456  InvalidNodeId(const Impl &impl);
457 
458  ~InvalidNodeId();
459 
460  protected:
461  InvalidNodeId(Impl *impl);
462 
464  };
465 
473  class DLL_PUBLIC Locked : public SDExceptionDatasetLocked
474  {
475  public:
479  std::string getPath();
480 
484  bool isReadLocked() const;
485 
489  bool isWriteLocked() const;
490 
494  bool lockFailed() const;
495 
499  bool unlockFailed() const;
500 
501  std::uint32_t getEstimatedLockLeaseSeconds() const;
502 
503  Reason const &reason() const = delete;
504 
505  std::uint32_t get_estimated_lock_lease_seconds() const = delete;
506 
507  class Impl;
508 
509  Locked(const Impl &impl);
510 
511  ~Locked();
512 
513  protected:
514  Locked(Impl *impl);
515 
516  std::shared_ptr<Impl> impl;
517  };
518 
519  namespace context
520  {
526  class DLL_PUBLIC NotReadOnly : public SDExpectedReadOnlyDatasetException
527  {
528  public:
532  std::string getPath();
533 
534  class Impl;
535 
536  NotReadOnly(const Impl &impl);
537 
538  ~NotReadOnly();
539 
540  protected:
541  NotReadOnly(Impl *impl);
542 
543  std::shared_ptr<Impl> impl;
544  };
545 
549  class DLL_PUBLIC Expired : public SDExceptionContextExpired
550  {
551  public:
555  std::string getPath();
556 
557  class Impl;
558 
559  Expired(const Impl &impl);
560 
561  ~Expired();
562 
563  protected:
564  Expired(Impl *impl);
565 
566  std::shared_ptr<Impl> impl;
567  };
568 
572  class DLL_PUBLIC UnknownFormat : public SDExceptionContextVersionTooNew
573  {
574  public:
578  std::string getPath();
579 
580  class Impl;
581 
582  UnknownFormat(const Impl &impl);
583 
584  ~UnknownFormat();
585 
586  protected:
587  UnknownFormat(Impl *impl);
588 
589  std::shared_ptr<Impl> impl;
590  };
591 
595  class DLL_PUBLIC PathMismatch : public SDExceptionContextPathNoMatch
596  {
597  public:
601  std::string getPath();
602 
606  std::string getContextPath();
607 
608  class Impl;
609 
610  PathMismatch(const Impl &impl);
611 
612  ~PathMismatch();
613 
614  protected:
615  PathMismatch(Impl *impl);
616 
617  std::shared_ptr<Impl> impl;
618  };
619  }
620  }
621 
622  namespace format
623  {
627  class DLL_PUBLIC Error : public SDExceptionValueError
628  {
629  public:
630  class Impl;
631 
632  Error(const Impl &impl);
633 
634  ~Error();
635 
636  protected:
637  Error(Impl *impl);
638 
639  std::shared_ptr<Impl> impl;
640  };
641 
645  class DLL_PUBLIC Json : public Error
646  {
647  public:
648  class Impl;
649 
650  Json(const Impl &impl);
651 
652  ~Json();
653 
654  protected:
655  Json(Impl *impl);
656 
658  };
659 
663  class DLL_PUBLIC ToJson : public Json
664  {
665  public:
666  class Impl;
667 
668  ToJson(const Impl &impl);
669 
670  ~ToJson();
671 
672  protected:
673  ToJson(Impl *impl);
674 
676  };
677 
681  class DLL_PUBLIC FromJson : public Json
682  {
683  public:
684  class Impl;
685 
686  FromJson(const Impl &impl);
687 
688  ~FromJson();
689 
690  std::string getMissingVariable();
691 
692  protected:
693  FromJson(Impl *impl);
694 
696  };
697  }
698 
699  namespace internal
700  {
704  class DLL_PUBLIC Error : public SDExceptionInternalError
705  {
706  public:
707  class Impl;
708 
709  Error(const Impl &impl);
710 
711  ~Error();
712 
713  protected:
714  Error(Impl *impl);
715 
716  std::shared_ptr<Impl> impl;
717  };
718  }
719 
720  // Not to be documented
721  class DLL_PUBLIC Exception : public SDException
722  {
723  protected:
724  class Impl;
725 
726  Exception(const Impl &impl);
727 
728  ~Exception();
729 
730  Exception(Impl *impl);
731 
732  std::shared_ptr<Impl> impl;
733  };
734 
735  namespace manager
736  {
740  class DLL_PUBLIC Error : public Exception
741  {
742  protected:
743  class Impl;
744 
745  Error(const Impl &impl);
746 
747  ~Error();
748 
749  Error(Impl *impl);
750 
752  };
753 
757  class DLL_PUBLIC AuthProviderNotSet : public Error
758  {
759  public:
760  class Impl;
761 
762  AuthProviderNotSet(const Impl &impl);
763 
765 
766  protected:
767  AuthProviderNotSet(Impl *impl);
768 
770  };
771 
775  class DLL_PUBLIC AuthProviderTypeChange : public Error
776  {
777  public:
778  class Impl;
779 
780  AuthProviderTypeChange(const Impl &impl);
781 
783 
784  protected:
786 
788  };
789 
790  namespace context
791  {
795  class DLL_PUBLIC UnknownFormat : public Error
796  {
797  public:
798  class Impl;
799 
800  UnknownFormat(const Impl &impl);
801 
802  ~UnknownFormat();
803 
804  protected:
805  UnknownFormat(Impl *impl);
806 
808  };
809  }
810 
814  class DLL_PUBLIC ServiceUrlNotSet : public Error
815  {
816  public:
817  class Impl;
818 
819  ServiceUrlNotSet(const Impl &impl);
820 
821  ~ServiceUrlNotSet();
822 
823  protected:
824  ServiceUrlNotSet(Impl *impl);
825 
827  };
828 
832  class DLL_PUBLIC ApiKeyNotSet : public Error
833  {
834  public:
835  class Impl;
836 
837  ApiKeyNotSet(const Impl &impl);
838 
839  ~ApiKeyNotSet();
840 
841  protected:
842  ApiKeyNotSet(Impl *impl);
843 
845  };
846  }
847 
848  namespace seismicstore
849  {
853  class DLL_PUBLIC ActionFailed : public SDExceptionSDAccessorError
854  {
855  public:
856  class Impl;
857 
858  ActionFailed(const Impl &impl);
859 
860  ~ActionFailed();
861 
862  protected:
863  ActionFailed(Impl *impl);
864 
865  std::shared_ptr<Impl> impl;
866  };
867 
871  class DLL_PUBLIC NotJson : public SDExpectedJsonException
872  {
873  public:
874  class Impl;
875 
876  NotJson(const Impl &impl);
877 
878  ~NotJson();
879 
880  protected:
881  NotJson(Impl *impl);
882 
883  std::shared_ptr<Impl> impl;
884  };
885  }
886 
887  namespace storage
888  {
892  class DLL_PUBLIC Error : public SDExceptionStorageError
893  {
894  public:
895  class Impl;
896 
897  Error(const Impl &impl);
898 
899  ~Error();
900 
901  protected:
902  Error(Impl *impl);
903 
904  std::shared_ptr<Impl> impl;
905  };
906 
910  class DLL_PUBLIC NotImplemented : public Error
911  {
912  public:
916  std::string whatsNotImplemented();
917 
918  class Impl;
919 
920  NotImplemented(const Impl &impl);
921 
922  ~NotImplemented();
923 
924  protected:
925  NotImplemented(Impl *impl);
926 
928  };
929 
930  class DLL_PUBLIC InvalidSasUri : public Error
931  {
932  public:
933  class Impl;
934 
935  InvalidSasUri(const Impl &impl);
936 
937  ~InvalidSasUri();
938 
939  protected:
940  InvalidSasUri(Impl *impl);
941 
943  };
944 
948  class DLL_PUBLIC AccessError : public SDExceptionGCSAccessorError
949  {
950  public:
951  class Impl;
952 
953  AccessError(const Impl &impl);
954 
955  ~AccessError();
956 
957  protected:
958  AccessError(Impl *impl);
959 
960  std::shared_ptr<Impl> impl;
961  };
962 
966  class DLL_PUBLIC ProviderError : public Error
967  {
968  public:
969  class Impl;
970 
971  ProviderError(const Impl &impl);
972 
973  ~ProviderError();
974 
975  protected:
976  ProviderError(Impl *impl);
977 
979  };
980 
984  class DLL_PUBLIC NotBuilt : public ProviderError
985  {
986  public:
990  std::string whatsNotBuilt();
991 
992  class Impl;
993 
994  NotBuilt(const Impl &impl);
995 
996  ~NotBuilt();
997 
998  protected:
999  NotBuilt(Impl *impl);
1000 
1002  };
1003  }
1004  }
1005 }
1006 
1007 #ifdef _MSC_VER
1008  #pragma warning(pop)
1009 #endif
Definition: SDException.h:663
std::shared_ptr< Impl > impl
Definition: SDException.h:589
Definition: SDException.h:966
Definition: SDException.h:704
Impl & impl
Definition: SDException.h:1001
Impl & impl
Definition: SDException.h:320
Definition: SDExceptionImpl.h:164
std::shared_ptr< Impl > impl
Definition: SDException.h:543
std::shared_ptr< Impl > impl
Definition: SDException.h:883
Definition: SDExceptionImpl.h:414
Definition: SDExceptionImpl.h:274
Definition: SDExceptionImpl.h:264
Definition: SDException.h:645
Definition: SDExceptionImpl.h:109
Definition: SDException.h:423
Definition: SDExceptionImpl.h:90
Definition: SDException.h:37
Definition: SDException.h:948
Definition: SDExceptionImpl.h:80
Definition: SDExceptionImpl.h:222
Impl & impl
Definition: SDException.h:787
Impl & impl
Definition: SDException.h:695
Impl & impl
Definition: SDException.h:297
Definition: SDException.h:257
Impl & impl
Definition: SDException.h:440
Definition: SDExceptionImpl.h:70
Definition: SDException.h:280
Definition: SDException.h:473
Impl & impl
Definition: SDException.h:826
Definition: SDException.h:721
Definition: SDExceptionImpl.h:118
Definition: SDException.h:892
Definition: SDException.h:349
Impl & impl
Definition: SDException.h:657
Definition: SDExceptionImpl.h:58
Definition: SDException.h:627
Impl & impl
Definition: SDException.h:807
Definition: SDException.h:930
Definition: SDException.h:446
Impl & impl
Definition: SDException.h:927
Definition: SDExceptionImpl.h:387
Definition: SDException.h:984
std::shared_ptr< Impl > impl
Definition: SDException.h:566
std::shared_ptr< Impl > impl
Definition: SDException.h:516
Definition: SDExceptionImpl.h:396
Definition: SDExceptionImpl.h:354
Definition: SDException.h:400
std::shared_ptr< Impl > impl
Definition: SDException.h:865
Definition: SDExceptionImpl.h:46
Definition: SDException.h:303
Impl & impl
Definition: SDException.h:343
std::shared_ptr< Impl > impl
Definition: SDException.h:225
Definition: SDExceptionImpl.h:285
Definition: SDException.h:832
Definition: SDException.h:213
Definition: SDExceptionImpl.h:100
Definition: SDException.h:871
Impl & impl
Definition: SDException.h:978
Definition: SDExceptionImpl.h:142
std::shared_ptr< Impl > impl
Definition: SDException.h:960
Impl & impl
Definition: SDException.h:751
Definition: SDExceptionImpl.h:231
Impl & impl
Definition: SDException.h:394
Definition: SDExceptionImpl.h:405
Impl & impl
Definition: SDException.h:675
Definition: Constants.h:27
std::shared_ptr< Impl > impl
Definition: SDException.h:732
Definition: SDExceptionImpl.h:249
std::shared_ptr< Impl > impl
Definition: SDException.h:904
Definition: SDExceptionImpl.h:132
Impl & impl
Definition: SDException.h:366
Impl & impl
Definition: SDException.h:844
Impl & impl
Definition: SDException.h:463
Definition: SDException.h:372
std::shared_ptr< Impl > impl
Definition: SDException.h:639
Impl & impl
Definition: SDException.h:417
Definition: SDExceptionImpl.h:366
std::shared_ptr< Impl > impl
Definition: SDException.h:617
Impl & impl
Definition: SDException.h:274
Impl & impl
Definition: SDException.h:942
Definition: SDExceptionImpl.h:152
Definition: SDException.h:681
std::shared_ptr< Impl > impl
Definition: SDException.h:716
Definition: SDException.h:740
Definition: SDExceptionImpl.h:333
Definition: SDException.h:326
Definition: SDExceptionImpl.h:240
Impl & impl
Definition: SDException.h:769
std::shared_ptr< Impl > impl
Definition: SDException.h:251
Definition: SDException.h:234