posix/except: add templated error_code
This commit is contained in:
parent
cc54d23998
commit
5b9eae9b25
@ -29,7 +29,6 @@ using util::posix::error;
|
||||
///
|
||||
/// The error value MUST be an error at construction time.
|
||||
error::error (int _code):
|
||||
std::runtime_error (::strerror (_code)),
|
||||
m_code (_code)
|
||||
{
|
||||
CHECK_NEQ (_code, 0);
|
||||
|
@ -25,7 +25,7 @@ namespace util::posix {
|
||||
///
|
||||
/// Ideally this would be named `errno' but that symbol is permitted to
|
||||
/// be a macro and significantly complicates symbol resolution either way.
|
||||
class error : public std::runtime_error {
|
||||
class error : public std::exception {
|
||||
public:
|
||||
explicit error (int code);
|
||||
error ();
|
||||
@ -52,6 +52,15 @@ namespace util::posix {
|
||||
};
|
||||
|
||||
|
||||
template <int CodeV>
|
||||
struct error_code : public error {
|
||||
error_code ():
|
||||
error (CodeV)
|
||||
{ ; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
class eai : public std::runtime_error {
|
||||
public:
|
||||
explicit eai (int code);
|
||||
|
Loading…
Reference in New Issue
Block a user