MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / jsonpath_error

Class jsonpath_error

include/jsoncons_ext/jsonpath/jsonpath_error.hpp:185–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183namespace jsonpath {
184
185 class jsonpath_error : public std::system_error, public virtual json_exception
186 {
187 std::size_t line_number_{0};
188 std::size_t column_number_{0};
189 mutable std::string what_;
190 public:
191 jsonpath_error(std::error_code ec)
192 : std::system_error(ec)
193 {
194 }
195 jsonpath_error(std::error_code ec, const std::string& what_arg)
196 : std::system_error(ec, what_arg)
197 {
198 }
199 jsonpath_error(std::error_code ec, std::size_t position)
200 : std::system_error(ec), column_number_(position)
201 {
202 }
203 jsonpath_error(std::error_code ec, std::size_t line, std::size_t column)
204 : std::system_error(ec), line_number_(line), column_number_(column)
205 {
206 }
207 jsonpath_error(const jsonpath_error& other) = default;
208
209 jsonpath_error(jsonpath_error&& other) = default;
210
211 ~jsonpath_error() override = default;
212
213 const char* what() const noexcept override
214 {
215 if (what_.empty())
216 {
217 JSONCONS_TRY
218 {
219 what_.append(std::system_error::what());
220 if (line_number_ != 0 && column_number_ != 0)
221 {
222 what_.append(" at line ");
223 what_.append(std::to_string(line_number_));
224 what_.append(" and column ");
225 what_.append(std::to_string(column_number_));
226 }
227 else if (column_number_ != 0)
228 {
229 what_.append(" at position ");
230 what_.append(std::to_string(column_number_));
231 }
232 return what_.c_str();
233 }
234 JSONCONS_CATCH(...)
235 {
236 return std::system_error::what();
237 }
238 }
239 else
240 {
241 return what_.c_str();
242 }

Callers 3

parseMethod · 0.85
compileMethod · 0.85
unflattenFunction · 0.85

Calls 1

c_strMethod · 0.45

Tested by

no test coverage detected