yiguolei commented on code in PR #23072:
URL: https://github.com/apache/doris/pull/23072#discussion_r1296581814
##########
be/src/common/status.h:
##########
@@ -346,10 +343,24 @@ class Status {
template <int code, bool stacktrace = true, typename... Args>
Status static Error(std::string_view msg, Args&&... args) {
- return Error<stacktrace>(code, msg, std::forward<Args>(args)...);
+ Status status;
+ status._code = code;
+ status._err_msg = std::make_unique<ErrMsg>();
+ if constexpr (sizeof...(args) == 0) {
+ status._err_msg->_msg = msg;
+ } else {
+ status._err_msg->_msg = fmt::format(msg,
std::forward<Args>(args)...);
+ }
+#ifdef ENABLE_STACKTRACE
+ if constexpr (stacktrace && capture_stacktrace(code)) {
+ status._err_msg->_stack = get_stack_trace();
+ LOG(WARNING) << "meet error status: " << status; // may print too
many stacks.
+ }
+#endif
+ return status;
}
- template <bool stacktrace = true, typename... Args>
+ template <bool stacktrace = false, typename... Args>
Status static Error(int code, std::string_view msg, Args&&... args) {
Review Comment:
this method has many duplicate codes with the previous method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]