MCPcopy Create free account
hub / github.com/apache/arrow / ToStringWithoutContextLines

Method ToStringWithoutContextLines

cpp/src/arrow/status.cc:125–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123}
124
125std::string Status::ToStringWithoutContextLines() const {
126 auto message = ToString();
127 while (true) {
128 auto last_new_line_position = message.rfind("\n");
129 if (last_new_line_position == std::string::npos) {
130 break;
131 }
132 // Check for the pattern ":\d+ " (colon followed by one or more digits and a space)
133 // to identify context lines in the format "filename:line expr"
134 auto colon_position = message.find(":", last_new_line_position);
135 if (colon_position == std::string::npos) {
136 break;
137 }
138 // Verify that the colon is followed by one or more digits and then a space
139 size_t pos = colon_position + 1;
140 if (pos >= message.size() ||
141 !std::isdigit(static_cast<unsigned char>(message[pos]))) {
142 break;
143 }
144 // Skip all digits
145 while (pos < message.size() &&
146 std::isdigit(static_cast<unsigned char>(message[pos]))) {
147 pos++;
148 }
149 // Check if followed by a space
150 if (pos >= message.size() || message[pos] != ' ') {
151 break;
152 }
153 message = message.substr(0, last_new_line_position);
154 }
155 return message;
156}
157
158const std::string& Status::message() const {
159 static const std::string no_message = "";

Callers 2

TESTFunction · 0.80
TYPED_TESTFunction · 0.80

Calls 4

substrMethod · 0.80
ToStringFunction · 0.70
findMethod · 0.45
sizeMethod · 0.45

Tested by 2

TESTFunction · 0.64
TYPED_TESTFunction · 0.64