X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c34ec0a9a237bf4befb762e35ab117731a8c3851..47950eebfede4e41862022469d15e5e4fe19c7ba:/src/surf/xml/surfxml_sax_cb.cpp diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index ffec861c3a..5433be3cc1 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -34,15 +34,15 @@ std::vector parsed_disk_list; /* temporary /* * Helping functions */ -void surf_parse_assert(bool cond, std::string&& msg) +void surf_parse_assert(bool cond, const std::string& msg) { if (not cond) - surf_parse_error(std::move(msg)); + surf_parse_error(msg); } -void surf_parse_error(std::string&& msg) +void surf_parse_error(const std::string& msg) { - throw simgrid::ParseError(surf_parse_lineno, surf_parsed_filename, std::move(msg)); + throw simgrid::ParseError(surf_parsed_filename, surf_parse_lineno, msg); } void surf_parse_assert_netpoint(const std::string& hostname, const std::string& pre, const std::string& post) @@ -247,7 +247,6 @@ double surf_parse_get_speed(const char* string, const char* entity_kind, const s static std::vector surf_parse_get_all_speeds(char* speeds, const char* entity_kind, const std::string& id) { - std::vector speed_per_pstate; if (strchr(speeds, ',') == nullptr){ @@ -1001,10 +1000,9 @@ void surf_parse_open(const std::string& file) 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;