mirror of
https://github.com/matrix-construct/construct
synced 2025-02-16 16:50:12 +01:00
ircd::fs: Add missing exception translation to read()/write() dispatchers.
This commit is contained in:
parent
e37a8599f7
commit
ceac1d96ac
1 changed files with 24 additions and 0 deletions
24
ircd/fs.cc
24
ircd/fs.cc
|
@ -93,6 +93,7 @@ const ircd::fs::read_opts_default
|
|||
std::string
|
||||
ircd::fs::read(const string_view &path,
|
||||
const read_opts &opts)
|
||||
try
|
||||
{
|
||||
#ifdef IRCD_USE_AIO
|
||||
if(likely(aioctx))
|
||||
|
@ -101,11 +102,19 @@ ircd::fs::read(const string_view &path,
|
|||
|
||||
return read__std(path, opts);
|
||||
}
|
||||
catch(const std::exception &e)
|
||||
{
|
||||
throw filesystem_error
|
||||
{
|
||||
"%s", e.what()
|
||||
};
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::fs::read(const string_view &path,
|
||||
const mutable_buffer &buf,
|
||||
const read_opts &opts)
|
||||
try
|
||||
{
|
||||
#ifdef IRCD_USE_AIO
|
||||
if(likely(aioctx))
|
||||
|
@ -114,6 +123,13 @@ ircd::fs::read(const string_view &path,
|
|||
|
||||
return read__std(path, buf, opts);
|
||||
}
|
||||
catch(const std::exception &e)
|
||||
{
|
||||
throw filesystem_error
|
||||
{
|
||||
"%s", e.what()
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
// std read
|
||||
|
@ -163,6 +179,7 @@ ircd::string_view
|
|||
ircd::fs::write(const string_view &path,
|
||||
const const_buffer &buf,
|
||||
const write_opts &opts)
|
||||
try
|
||||
{
|
||||
#ifdef IRCD_USE_AIO
|
||||
if(likely(aioctx))
|
||||
|
@ -171,6 +188,13 @@ ircd::fs::write(const string_view &path,
|
|||
|
||||
return write__std(path, buf, opts);
|
||||
}
|
||||
catch(const std::exception &e)
|
||||
{
|
||||
throw filesystem_error
|
||||
{
|
||||
"%s", e.what()
|
||||
};
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::fs::write__std(const string_view &path,
|
||||
|
|
Loading…
Add table
Reference in a new issue