Skip to content
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

[common][PIR] fix SimplifyErrorTypeFormat formatting error #63106

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix error msg
  • Loading branch information
gouzil committed Mar 29, 2024
commit bf2d97134e709d85b99ffda8110fb792cb016d8c
11 changes: 7 additions & 4 deletions paddle/common/enforce.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,15 @@ int GetCallStackLevel() { return FLAGS_call_stack_level; }
std::string SimplifyErrorTypeFormat(const std::string& str) {
std::ostringstream sout;
size_t type_end_pos = str.find(':', 0);
if (type_end_pos == std::string::npos) {
sout << str;
} else {
// Remove "Error:", add "()""
if (str.substr(type_end_pos - 5, type_end_pos) == "Error:") {
// Remove "Error:", add "()"
// Examples:
// InvalidArgumentError: xxx -> (InvalidArgument): xxx
sout << "(" << str.substr(0, type_end_pos - 5) << ")"
<< str.substr(type_end_pos + 1);
} else {
// type_end_pos == std::string::npos
sout << str;
}
return sout.str();
}
Expand Down
2 changes: 1 addition & 1 deletion paddle/pir/src/core/op_result_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ uint32_t OpResultImpl::index() const {
OpResultImpl::~OpResultImpl() {
if (!use_empty()) {
PADDLE_FATAL(
"Destroyed a op_result that is still in use. The owner op type is : %s",
"Destroyed a op_result that is still in use. The owner op type is: %s",
owner()->name());
}
}
Expand Down