Skip to content

Unprocessed return value in DatNode::unlink() #34

@mbohal

Description

@mbohal

Problem

When I try to call:

void DataNode::unlink()

on a list key libyang::lyd_unlink_tree() returns error value. However this return value is ignored and the function unlink() nor returns error nor throws.

In other places the return value is handled correctly:

DataNodeTerm::ValueChange DataNodeTerm::changeValue(const std::string value)

Proposal

I think the

void handleLyTreeOperation(DataNode* affectedNode, Operation operation, OperationScope scope, std::shared_ptr<internal_refcount> newRefs)
method should be modified to throw if operation returns an error value.

Essentially changing this:

operation();

to this:

auto ret = operation();
throwIfError(ret, "libyang::unlink");

This would effect other methods, that also use handleLyTreeOperation(), but it seems to me, that is the desired state anyway.

This change, however, would change the public API of the library. How should it be handled?
Would you accept a PR in gerrit?

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