This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 4e9b32d622 [bugfix](exception) remove fmt code to test if there still exist core (#19009) 4e9b32d622 is described below commit 4e9b32d622ff577fe17bdf2a3c90e04f34ebaabd Author: yiguolei <676222...@qq.com> AuthorDate: Tue Apr 25 07:24:14 2023 +0800 [bugfix](exception) remove fmt code to test if there still exist core (#19009) --- be/src/common/exception.h | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/be/src/common/exception.h b/be/src/common/exception.h index 29437cfead..c3da566066 100644 --- a/be/src/common/exception.h +++ b/be/src/common/exception.h @@ -45,14 +45,10 @@ public: Exception(int code, const std::string_view fmt, Args&&... args) : Exception(code, fmt::format(fmt, std::forward<Args>(args)...)) {} - std::string code_as_string() const { return fmt::format("E{}", _code); } - int code() const { return _code; } std::string to_string() const; - friend std::ostream& operator<<(std::ostream& ostr, const Exception& exp); - private: int _code; struct ErrMsg { @@ -63,22 +59,17 @@ private: std::unique_ptr<Exception> _nested_excption; }; -inline std::ostream& operator<<(std::ostream& ostr, const Exception& exp) { - ostr << '[' << exp.code_as_string() << "] "; - ostr << (exp._err_msg ? exp._err_msg->_msg : ""); - if (exp._err_msg && !exp._err_msg->_stack.empty()) { - ostr << '\n' << exp._err_msg->_stack; +inline std::string Exception::to_string() const { + std::stringstream ostr; + ostr << "[E" << _code << "] "; + ostr << (_err_msg ? _err_msg->_msg : ""); + if (_err_msg && !_err_msg->_stack.empty()) { + ostr << '\n' << _err_msg->_stack; } - if (exp._nested_excption != nullptr) { - ostr << '\n' << "Caused by:" << *exp._nested_excption; + if (_nested_excption != nullptr) { + ostr << '\n' << "Caused by:" << _nested_excption->to_string(); } - return ostr; -} - -inline std::string Exception::to_string() const { - std::stringstream ss; - ss << *this; - return ss.str(); + return ostr.str(); } } // namespace doris \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org