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:
parent
1a53b0e6e4
commit
482112b369
1 changed files with 8 additions and 15 deletions
23
ircd/mods.cc
23
ircd/mods.cc
|
@ -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()
|
||||
};
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue