blob: 22783a38b6e8e3775fd16d503577e8e03683f27a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/*
* This source code is released into the public domain.
*/
#ifndef LFJAIL_IO_ERROR_HH
#define LFJAIL_IO_ERROR_HH
#include <string>
#include <system_error>
#include <utility>
#include "generic_error.hh"
namespace lfjail {
struct io_error final : generic_error {
std::string path;
std::error_code error;
io_error(std::string path_, std::error_code error_)
: generic_error("{0}: {1}", path_, error_.message())
, path(std::move(path_))
, error(error_)
{}
io_error(std::string path_, int error_)
: io_error(std::move(path_),
make_error_code(static_cast<std::errc>(error_)))
{}
};
} // namespace lfjail
#endif // LFJAIL_IO_ERROR_HH
|