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

Add advance error reporting for custom write_handler() #273

Open
jasimmons1973 opened this issue Aug 25, 2023 · 0 comments
Open

Add advance error reporting for custom write_handler() #273

jasimmons1973 opened this issue Aug 25, 2023 · 0 comments

Comments

@jasimmons1973
Copy link

Currently libyaml handle the write_handler:

if (emitter->write_handler(emitter->write_handler_data,
emitter->buffer.start,
emitter->buffer.last - emitter->buffer.start)) {
emitter->buffer.last = emitter->buffer.start;
emitter->buffer.pointer = emitter->buffer.start;
return 1;
}
else {
return yaml_emitter_set_writer_error(emitter, "write error");
}

This means for custom write_handler any error is reported as "write error". I like to purpose is that we do

else {
return yaml_emitter_set_writer_error(emitter, emitter->problem ? emitter->problem : "write error");

This way if the custom write_handler sets the emitter->problem field we can use that information instead.

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

1 participant