diff options
author | Ben Burdette <bburdette@gmail.com> | 2020-05-06 14:07:20 -0600 |
---|---|---|
committer | Ben Burdette <bburdette@gmail.com> | 2020-05-06 14:07:20 -0600 |
commit | e76ad2e48a71aa9804311f4dfb34374a5295b3b6 (patch) | |
tree | 1f15bd925884c5353a456e5e622f81436ab4f3ba /src/libutil/error.hh | |
parent | 7ffb5efdbc943851d2ee9d0573dca3e96b9bd742 (diff) |
implement SysError errno handling
Diffstat (limited to 'src/libutil/error.hh')
-rw-r--r-- | src/libutil/error.hh | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libutil/error.hh b/src/libutil/error.hh index 86cff5609..2155ad344 100644 --- a/src/libutil/error.hh +++ b/src/libutil/error.hh @@ -160,13 +160,14 @@ public: template<typename... Args> SysError(const Args & ... args) - : Error(args...) // TODO addErrNo for hintfmt - // : Error(addErrno(hintfmt(args...))) - { } - -private: + :Error("") + { + errNo = errno; + auto hf = hintfmt(args...); + err.hint = hintfmt("%1% : %2%", normaltxt(hf.str()), strerror(errNo)); + } - std::string addErrno(const std::string & s); + virtual const char* sname() const override { return "SysError"; } }; } |