-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug error msg format #5866
Fix bug error msg format #5866
Conversation
liufengwei0103
commented
Aug 13, 2021
•
edited
Loading
edited
- 重写了语义更明显的函数名
- 重写了把msg缩短的函数
- 加上了在error_type中的msg信息
oneflow/core/common/error_util.cpp
Outdated
ss << error->config_resource_unavailable_error().DebugString(); | ||
break; | ||
case cfg::ErrorProto::kConfigAssertFailedError: | ||
ss << error->config_assert_failed_error().DebugString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以看下这个可不可以用反射实现,这样手动列出每一种情况是不可维护的,用反射的话伪代码大概是这样:
ss << PbMessage2Txt(error->getMessage(error->error_type_name()))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以看下这个可不可以用反射实现,这样手动列出每一种情况是不可维护的,用反射的话伪代码大概是这样:
ss << PbMessage2Txt(error->getMessage(error->error_type_name()))
已修改采用反射实现
ss << " ... "; | ||
CHECK_OR_RETURN(right_index >= 0); | ||
CHECK_OR_RETURN(right_index < str.size()); | ||
ss << str.substr(right_index); | ||
return ss.str(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是否需要包一层CHECK?
ss << "\n" << FormatErrorSummaryAndMsg(error); | ||
// Get msg from error type of error proto | ||
std::string msg_of_error_type = *JUST(FormatMsgOfErrorType(error)); | ||
if (msg_of_error_type.size() != 0) { ss << "\n" << msg_of_error_type; } | ||
return ss.str(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是否也要check下
Speed stats:
|
…flow into fix_bug_error_msg_format
Speed stats:
|