VMware GemFire Native Client Cache Reference  9.0.6
Exception.hpp
Go to the documentation of this file.
1 #ifndef __GEMFIRE_EXCEPTION_H__
2 #define __GEMFIRE_EXCEPTION_H__
3 /*=========================================================================
4  * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
5  * This product is protected by U.S. and international copyright
6  * and intellectual property laws. Pivotal products are covered by
7  * more patents listed at http://www.pivotal.io/patents.
8  *========================================================================
9  */
10 
15 #include "gfcpp_globals.hpp"
16 #include "gf_types.hpp"
17 
18 namespace gemfire {
19 
20  #define GF_EX_MSG_LIMIT 2048
21 
22  class Exception;
23  typedef SharedPtr<Exception> ExceptionPtr;
24 
25  class DistributedSystem;
26 
32  {
36  public:
37 
46  Exception(const char* msg1, const char* msg2 = NULL,
47  bool forceTrace = false, const ExceptionPtr& cause = NULLPTR);
48 
53  Exception( const Exception& other );
54 
56  virtual Exception* clone() const;
57 
61  virtual ~Exception();
62 
67  virtual const char * getMessage() const;
71  virtual void showMessage() const;
72 
76  virtual void printStackTrace() const;
77 
78 #ifndef _SOLARIS
79 
82  virtual size_t getStackTrace( char* buffer, size_t maxLength ) const;
83 #endif
84 
86  virtual const char* getName( ) const;
87 
92  virtual void raise()
93  {
94  throw *this;
95  }
96 
97  inline ExceptionPtr getCause() const
98  {
99  return m_cause;
100  }
101 
102  protected:
104  Exception(const CacheableStringPtr& message, const StackTracePtr& stack,
105  const ExceptionPtr& cause);
106 
107  static bool s_exceptionStackTraceEnabled;
108 
109  CacheableStringPtr m_message; //error message
110  StackTracePtr m_stack;
111  ExceptionPtr m_cause;
112 
113  private:
114  static void setStackTraces(bool stackTraceEnabled);
115 
116  friend class DistributedSystem;
117  };
118 
119 } // namespace gemfire
120 
121 #endif //ifndef __GEMFIRE_EXCEPTION_H__
This namespace contains all the GemFire C++ API classes, enumerations and globals.
Definition: Assert.hpp:19
DistributedSystem encapsulates this applications "connection" into the GemFire Java servers distribut...
Definition: DistributedSystem.hpp:35
#define CPPCACHE_EXPORT
Defines a GemFire CPPCACHE export.
Definition: gf_base.hpp:51
This abstract base class is the base class of all user objects that have the shared capability of ref...
Definition: SharedBase.hpp:31
A description of an exception that occurred during a cache operation.
Definition: Exception.hpp:31

GemFire C++ Cache API Documentation