0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-27 11:18:51 +02:00

ircd::fs: Add missing exception translation to read()/write() dispatchers.

This commit is contained in:
Jason Volk 2018-02-26 20:45:40 -08:00
parent e37a8599f7
commit ceac1d96ac

View file

@ -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,