swift
statusexception.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_MISC_STATUSEXCEPTION_H
7 #define SWIFT_MISC_STATUSEXCEPTION_H
8 
9 #include <exception>
10 
11 #include <QByteArray>
12 #include <QReadWriteLock>
13 
14 #include "misc/statusmessage.h"
15 #include "misc/swiftmiscexport.h"
16 
17 namespace swift::misc
18 {
22  class SWIFT_MISC_EXPORT CStatusException : public std::exception
23  {
24  public:
26  explicit CStatusException(const CStatusMessage &payload);
27 
29  CStatusException(const CStatusException &other);
30 
33 
35  virtual const char *what() const noexcept override;
36 
38  const CStatusMessage &status() const { return m_payload; }
39 
41  ~CStatusException() override {}
42 
44  static void maybeThrow(const CStatusMessage &);
45 
46  private:
47  const CStatusMessage m_payload;
48  mutable QByteArray m_temp;
49  mutable QReadWriteLock m_lock;
50  };
51 } // namespace swift::misc
52 
53 #endif // SWIFT_MISC_STATUSEXCEPTION_H
Throwable exception class containing a CStatusMessage.
CStatusException & operator=(const CStatusException &)=delete
Copy assignment (because of mutex)
Streamable status message, e.g.
Free functions in swift::misc.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.