From f8fc81a5c9fcd986473797df9286c6c9fef683bf Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 21 Aug 2018 17:34:57 +0200 Subject: Add utility functions for throwing ios::failure --- libbutl/utility.mxx | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libbutl/utility.mxx') diff --git a/libbutl/utility.mxx b/libbutl/utility.mxx index 1c457f5..54c7b43 100644 --- a/libbutl/utility.mxx +++ b/libbutl/utility.mxx @@ -60,6 +60,15 @@ LIBBUTL_MODEXPORT namespace butl [[noreturn]] LIBBUTL_SYMEXPORT void throw_system_error (int system_code, int fallback_errno_code = 0); + // Throw std::ios::failure with the specified description and, if it is + // derived from std::system_error (as it should), error code. + // + [[noreturn]] LIBBUTL_SYMEXPORT void + throw_generic_ios_failure (int errno_code, const char* what = nullptr); + + [[noreturn]] LIBBUTL_SYMEXPORT void + throw_system_ios_failure (int system_code, const char* what = nullptr); + // Convert ASCII character/string case. If there is no upper/lower case // counterpart, leave the character unchanged. The POSIX locale (also known // as C locale) must be the current application locale. Otherwise the -- cgit v1.1