Skip to content

Commit

Permalink
Revert "Simplify cq::Exception"
Browse files Browse the repository at this point in the history
This reverts commit fec28a7.
  • Loading branch information
stdrc committed Feb 10, 2020
1 parent fec28a7 commit 62b9673
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/core/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@
namespace cq {
// cq 命名空间下所有异常类型的基类
struct Exception : std::exception {
using std::exception::exception;
Exception(const char *what_arg) : Exception(std::string(what_arg)) {
}

Exception(const std::string &what_arg) : what_arg_(what_arg) {
}

explicit Exception(const string &message) : std::exception(message.c_str()) {
// 异常描述
const char *what() const noexcept override {
return what_arg_.c_str();
}

protected:
std::string what_arg_;
};

// 用户用法错误导致的异常
Expand Down

0 comments on commit 62b9673

Please sign in to comment.