0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-13 16:33:53 +01:00

ircd::mods: Improve exception translation.

This commit is contained in:
Jason Volk 2019-01-13 16:55:52 -08:00
parent 1a53b0e6e4
commit 482112b369

View file

@ -855,25 +855,18 @@ template<class R,
R
ircd::mods::info(const filesystem::path &path,
F&& closure)
try
{
if(!exists(path))
throw fs::error
{
make_error_code(std::errc::no_such_file_or_directory),
"`%s' does not exist",
path.string()
};
if(!is_regular_file(path))
throw fs::error
{
"`%s' is not a file",
path.string()
};
boost::dll::library_info info(path);
return closure(info);
}
catch(const filesystem::filesystem_error &e)
{
throw fs::error
{
e, "%s", path.string()
};
}
///////////////////////////////////////////////////////////////////////////////
//