Is it neccessary to return optional<DataNode> from newPath methods? Is there any case where the returned node is NULL but the underlying lyd_new_path returns LY_SUCCESS? Also, we always check for std::nullopt in {DataNode,Context}::newPath and throw logic_error if that happens so it seems that we actually might want newPath to return just DataNode.