aboutsummaryrefslogtreecommitdiff
path: root/include/cru/common/Exception.h
blob: 365d20642b7d284a078359a79c93f4b9fd4bee71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once
#include "String.h"

namespace cru {
#ifdef _MSC_VER
#pragma warning(disable : 4275)
#endif
class CRU_BASE_API Exception : public std::exception {
 public:
  Exception();
  explicit Exception(String message);

  CRU_DEFAULT_COPY(Exception)
  CRU_DEFAULT_MOVE(Exception)

  ~Exception() override;

 public:
  String GetMessage() const { return message_; }

  const char* what() const noexcept override;

 private:
  String message_;
  mutable std::string utf8_message_;
};

class CRU_BASE_API TextEncodeException : public Exception {
 public:
  using Exception::Exception;
};
}  // namespace cru