CernVM-FS  2.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
except.h
Go to the documentation of this file.
1 
5 #ifndef CVMFS_PUBLISH_EXCEPT_H_
6 #define CVMFS_PUBLISH_EXCEPT_H_
7 
8 #include <stdexcept>
9 #include <string>
10 
11 namespace publish {
12 
13 class EPublish : public std::runtime_error {
14  public:
18  enum EFailures {
20  kFailInput, // Invalid input
21  kFailInvocation, // Invalid command line options
22  kFailPermission, // Not owner of the repository
23  kFailTransactionState, // The txn was expected to be in the other state
24  kFailGatewayKey, // cannot access the gateway secret key
25  kFailLeaseHttp, // cannot connect to the gateway HTTP endpoint
26  kFailLeaseBody, // corrupted session token
27  kFailLeaseBusy, // another active lease blocks the path
28  kFailLeaseNoEntry, // the lease path does not exist
29  kFailLeaseNoDir, // the lease path is no a directory
30  kFailRepositoryNotFound, // the repository was not found on the machine
31  kFailRepositoryType, // the stratum type (0, 1) does not match
32  kFailLayoutRevision, // unsupported layout revision, migrate required
34  kFailMissingDependency, // a program or service was not found
35  };
36 
37  explicit EPublish(const std::string& what, EFailures f = kFailUnspecified)
38  : std::runtime_error(what + "\n\nStacktrace:\n" + GetStacktrace())
39  , failure_(f)
40  , msg_(what)
41  {}
42 
43  virtual ~EPublish() throw();
44 
45  EFailures failure() const { return failure_; }
46  std::string msg() const { return msg_; }
47 
48  private:
50  std::string msg_;
51 
55  static const unsigned kMaxBacktrace = 64;
56  static std::string GetStacktrace();
57 };
58 
59 } // namespace publish
60 
61 #endif // CVMFS_PUBLISH_EXCEPT_H_
EFailures failure_
Definition: except.h:49
EPublish(const std::string &what, EFailures f=kFailUnspecified)
Definition: except.h:37
std::string msg() const
Definition: except.h:46
std::string msg_
Definition: except.h:50
virtual ~EPublish()
Definition: except.cc:11
EFailures failure() const
Definition: except.h:45
static std::string GetStacktrace()
Definition: except.cc:13
static const unsigned kMaxBacktrace
Definition: except.h:55