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

Class ErrorStackFrame

oneflow/core/common/error.h:49–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47namespace oneflow {
48
49class ErrorStackFrame final {
50 public:
51 ErrorStackFrame(const ErrorStackFrame&) = default;
52 ErrorStackFrame(const std::string& file, int64_t line, const std::string& function)
53 : file_(RemoveProjectPathPrefix(file)), line_(line), function_(function), code_text_() {}
54 ErrorStackFrame(const std::string& file, int64_t line, const std::string& function,
55 const std::string& code_text)
56 : file_(RemoveProjectPathPrefix(file)),
57 line_(line),
58 function_(function),
59 code_text_(code_text) {}
60
61 bool operator==(const ErrorStackFrame& other) const {
62 return this->file_ == other.file_ && this->line_ == other.line_
63 && this->function_ == other.function_ && this->code_text_ == other.code_text_;
64 }
65
66 const std::string& file() const { return file_; }
67 int64_t line() const { return line_; }
68 const std::string& function() const { return function_; }
69 const std::string& code_text() const { return code_text_; }
70
71 std::string DebugString() const {
72 return file_ + ":" + std::to_string(line_) + " " + function_ + "\n\t" + code_text_ + "\n";
73 }
74
75 private:
76 std::string file_;
77 int64_t line_;
78 std::string function_;
79 std::string code_text_;
80};
81
82} // namespace oneflow
83

Callers 1

error.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected