MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / FormatErrorStr

Function FormatErrorStr

oneflow/core/common/error_util.cpp:134–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132} // namespace
133
134Maybe<std::string> FormatErrorStr(const std::shared_ptr<StackedError>& error) {
135 std::stringstream ss;
136 ss << error->error_proto()->msg();
137 ss << error->error_proto()->frame_msg();
138 // Get msg from stack frame of error proto
139 for (auto iter = error->stack_frame().rbegin(); iter < error->stack_frame().rend(); iter++) {
140 auto stack_frame = *iter;
141 ss << FormatFileOfStackFrame(stack_frame->file()) << FormatLineOfStackFrame(stack_frame->line())
142 << FormatFunctionOfStackFrame(stack_frame->function())
143 << *JUST(FormatMsgOfStackFrame(stack_frame->code_text(),
144 iter == error->stack_frame().rend() - 1));
145 }
146 // Get msg from error type of error proto
147 std::string msg_of_error_type = *JUST(FormatMsgOfErrorType(error));
148 if (msg_of_error_type.size() != 0) { ss << "\n" << msg_of_error_type; }
149 return ss.str();
150}
151
152} // namespace oneflow

Callers 2

GetStackedErrorStringFunction · 0.85

Calls 7

FormatFileOfStackFrameFunction · 0.85
FormatLineOfStackFrameFunction · 0.85
FormatMsgOfStackFrameFunction · 0.85
FormatMsgOfErrorTypeFunction · 0.85
lineMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected