field name/value in error message #1699
Replies: 2 comments 6 replies
-
|
The library should return NO_SUCH_FIELD following a query such as obj["myfied"] which should not be hard to debug. If you have some specific issue, please elaborate. Consider providing code samples. The error codes in simdjson are part of an enums. They are fixed size and allocation free They do not and cannot capture the context of use. So it is important for you to really explained the issue with precision so we can see how we can help. |
Beta Was this translation helpful? Give feedback.
-
|
May be an optional helper class to collect errors is a solution. I just created an interface to simdjson_peval::error error_collection(true /* switch path collection on */);
{
simdjson_peval::error::path_scope hight_scope(&error_collection, "height");
auto error = dataobject["height"].get(val);
if (error) {
error_collection.add(error);
}
}
...
if (error_collection) {
std::err << error_collection.to_string();
// output: at <root>.height: <the error message>
}See also: UserGuide/Save Errors May such a class could also be integrated somehow: dataobject["height"].get_collect_error(val, error_container, "height");
// or
arrayElement.get_collect_error(val, error_container, arrayIndex); |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, sometimes I receive field-related exception such as INCORRECT_TYPE, NO_SUCH_FIELD. I am wondering if we can add field name into error message otherwise it would take peopple more time to debug code and find out. Thanks.
Beta Was this translation helpful? Give feedback.
All reactions