Skip to content

Missing error management in reader method #1226

@hschreiber

Description

@hschreiber

The method read_lower_triangular_matrix_from_csv_file in reader_utils.h does not throw anything when the given file is not found and just returns an empty vector.

std::vector<std::vector<Filtration_value>> result;
std::ifstream in;
in.open(filename.c_str());
if (!in.is_open()) {
  return result;
}

The behavior of the C++ functions doesn't look very good then, the calling function won't notice if there is an error (unless it somehow redirects cerr and monitors it). If it threw an exception, then the python wrapper would have nothing to do.

Originally posted by @mglisse in #1196 (comment)

(After Nanobind PR) As reader_utils.py is only there to verify the existence of the input file, it could be completely removed if the C++ method throws an appropriate error (std::invalid_argument + message giving the file name looks sufficient?).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions