surf_parse_error(std::move(msg));
}
+void surf_parse_error(const char* msg) {
+ throw simgrid::ParseError(surf_parse_lineno, surf_parsed_filename, std::string(msg));
+}
+
void surf_parse_error(std::string&& msg)
{
throw simgrid::ParseError(surf_parse_lineno, surf_parsed_filename, std::move(msg));
surf_path.push_back(dir);
surf_file_to_parse = surf_fopen(file, "r");
- if (surf_file_to_parse == nullptr) {
- std::string cwd = simgrid::xbt::Path().get_name();
- xbt_die("Unable to open '%s' from '%s'\n", file.c_str(), cwd.c_str());
- }
+ if (surf_file_to_parse == nullptr)
+ throw std::invalid_argument(std::string("Unable to open ')") + file + "' from '" + simgrid::xbt::Path().get_name() +
+ "'. Does this file exist?");
surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, YY_BUF_SIZE);
surf_parse__switch_to_buffer(surf_input_buffer);
surf_parse_lineno = 1;