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

Method ToStringWithoutContextLines

cpp/src/arrow/status.cc:127–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

TESTFunction · 0.80

Calls 4

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

Tested by 1

TESTFunction · 0.64