posix/except: add 'what' member for code class
This commit is contained in:
parent
a7ce62cd66
commit
a4844fa7ed
@ -11,7 +11,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Copyright 2010, 2017,
|
||||
* Copyright 2010-2018
|
||||
* Danny Robson <danny@nerdcruft.net>
|
||||
*/
|
||||
|
||||
@ -98,6 +98,16 @@ error::throw_code (int code)
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
const char*
|
||||
error::what (void) const noexcept
|
||||
{
|
||||
return strerror (m_code);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
using util::posix::eai;
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Copyright 2010, 2017,
|
||||
* Copyright 2010-2018
|
||||
* Danny Robson <danny@nerdcruft.net>
|
||||
*/
|
||||
|
||||
@ -39,6 +39,8 @@ namespace util::posix {
|
||||
static void throw_code [[gnu::noreturn]] (void);
|
||||
static void throw_code [[gnu::noreturn]] (int code);
|
||||
|
||||
virtual const char* what (void) const noexcept final override;
|
||||
|
||||
template <typename T>
|
||||
static T try_value (T value)
|
||||
{
|
||||
@ -48,7 +50,7 @@ namespace util::posix {
|
||||
}
|
||||
|
||||
private:
|
||||
int m_code;
|
||||
int const m_code;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user