Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Add more context to error traces #399

Open
mcandre opened this issue Jan 16, 2024 · 3 comments
Open

Request: Add more context to error traces #399

mcandre opened this issue Jan 16, 2024 · 3 comments

Comments

@mcandre
Copy link

mcandre commented Jan 16, 2024

rapidyaml often reports check failed: (ch != NONE) when attempting to traverse YAML data that omits expected keys.

In large applications, most users will be confused by this message, unable to take action to correct the mistake.

Can we please present more specific error messages. For example, indicate the name of the YAML key that the application was attempting to lookup.

@emmett2020
Copy link

Thats what I meet either. I make a wrapper for the lower level API usages. Its not easy and costs lots of time. Maybe a more detailed error trace messages should be added by ryml.

@biojppm
Copy link
Owner

biojppm commented Apr 1, 2024

I agree that the error messages could be improved. I am revisiting this in the context of #389 and I will devise a better solution.

@biojppm
Copy link
Owner

biojppm commented Apr 14, 2024

Actually this fix missed the boat on #389.

I'm thinking of adding a second error handler for node visitation:

// existing error handler: tuned for parsing
using pfn_error = void (*) (const char* msg, size_t msg_len, Location location, void *user_data);

// to be added: tuned for visiting
using pfn_error_visit = void (*) (const char* msg, size_t msg_len, Tree const& tree, size_t id, void *user_data);

But this involves a thorough look at the existing calls, so it will have to wait for ongoing work to be merged in (specifically #414 which is giant).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants