VMware GemFire Native C++ Reference  9.1
Exception.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef GEODE_EXCEPTION_H_
4 #define GEODE_EXCEPTION_H_
5 
6 /*
7  * Licensed to the Apache Software Foundation (ASF) under one or more
8  * contributor license agreements. See the NOTICE file distributed with
9  * this work for additional information regarding copyright ownership.
10  * The ASF licenses this file to You under the Apache License, Version 2.0
11  * (the "License"); you may not use this file except in compliance with
12  * the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22 
27 #include "geode_globals.hpp"
28 #include "geode_types.hpp"
29 
30 namespace apache {
31 namespace geode {
32 namespace client {
33 
34 #define GF_EX_MSG_LIMIT 2048
35 
36 class Exception;
37 typedef SharedPtr<Exception> ExceptionPtr;
38 
39 class DistributedSystem;
40 
49  public:
58  Exception(const char* msg1, const char* msg2 = NULL, bool forceTrace = false,
59  const ExceptionPtr& cause = NULLPTR);
60 
65  Exception(const Exception& other);
66 
68  virtual Exception* clone() const;
69 
73  virtual ~Exception();
74 
79  virtual const char* getMessage() const;
83  virtual void showMessage() const;
84 
88  virtual void printStackTrace() const;
89 
90 #ifndef _SOLARIS
91 
94  virtual size_t getStackTrace(char* buffer, size_t maxLength) const;
95 #endif
96 
98  virtual const char* getName() const;
99 
104  virtual void raise() { throw * this; }
105 
106  inline ExceptionPtr getCause() const { return m_cause; }
107 
108  protected:
110  Exception(const CacheableStringPtr& message, const StackTracePtr& stack,
111  const ExceptionPtr& cause);
112 
113  static bool s_exceptionStackTraceEnabled;
114 
115  CacheableStringPtr m_message; // error message
116  StackTracePtr m_stack;
117  ExceptionPtr m_cause;
118 
119  private:
120  static void setStackTraces(bool stackTraceEnabled);
121 
122  friend class DistributedSystem;
123 };
124 } // namespace client
125 } // namespace geode
126 } // namespace apache
127 
128 #endif // GEODE_EXCEPTION_H_
Each enum represents a predefined RegionAttributes in a Cache.
Definition: Assert.hpp:31
DistributedSystem encapsulates this applications "connection" into the Geode Java servers distributed...
Definition: DistributedSystem.hpp:50
#define CPPCACHE_EXPORT
Defines a Geode CPPCACHE export.
Definition: geode_base.hpp:58
A description of an exception that occurred during a cache operation.
Definition: Exception.hpp:45
This abstract base class is the base class of all user objects that have the shared capability of ref...
Definition: SharedBase.hpp:40
This namespace contains all the Geode C++ API classes, enumerations and globals.

Pivotal GemFire C++ Cache API Documentation