VMware VMware GemFire Native C++ Reference 10.4.3
Loading...
Searching...
No Matches
Exception.hpp
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#pragma once
19
20#ifndef GEODE_EXCEPTION_H_
21#define GEODE_EXCEPTION_H_
22
23#include <stdexcept>
24#include <string>
25#include <unordered_map>
26
27#include "internal/functional.hpp"
28#include "internal/geode_globals.hpp"
29
30namespace apache {
31namespace geode {
32namespace client {
33
34class StackTrace;
35
36#if defined(_MSC_VER)
37// Ignore C4275 - This class extends std C++ class
38#pragma warning(push)
39#pragma warning(disable : 4275)
40#endif
41
45class APACHE_GEODE_EXPORT Exception : public std::exception {
46 public:
47 explicit Exception(const std::string& message);
48 explicit Exception(std::string&& message);
49 explicit Exception(const char* message);
50 Exception(const Exception&) = default;
51 Exception& operator=(const Exception&) = default;
52 Exception(Exception&&) noexcept = default;
53 Exception& operator=(Exception&&) = default;
54 ~Exception() noexcept override;
55
59 virtual std::string getStackTrace() const;
60
64 virtual std::string getName() const;
65
69 virtual const std::string& getMessage() const noexcept;
70
71 const char* what() const noexcept override;
72
73 private:
74 std::string message_;
75 std::shared_ptr<StackTrace> stack_;
76};
77
78#if defined(_MSC_VER)
79#pragma warning(pop)
80#endif
81
82} // namespace client
83} // namespace geode
84} // namespace apache
85
86#endif // GEODE_EXCEPTION_H_
A description of an exception that occurred during a cache operation.
Definition Exception.hpp:45
virtual std::string getName() const
Return the name of this exception type.
virtual std::string getStackTrace() const
Get a stacktrace string from the location the exception was created.
virtual const std::string & getMessage() const noexcept
Get a message with details regarding this exception.

Apache Geode C++ Cache API Documentation