Skip to content

Add advance error reporting for custom write_handler() #273

@jasimmons1973

Description

@jasimmons1973

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions