aboutsummaryrefslogtreecommitdiff
path: root/libbutl/utility.mxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-08-21 17:34:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-08-21 17:34:57 +0200
commitf8fc81a5c9fcd986473797df9286c6c9fef683bf (patch)
treed81b4a0c456f776bd40725efa372e81441d88196 /libbutl/utility.mxx
parent338a16f0df3c45bcbeaf5e7ffd0b4dc515e11502 (diff)
Add utility functions for throwing ios::failure
Diffstat (limited to 'libbutl/utility.mxx')
-rw-r--r--libbutl/utility.mxx9
1 files changed, 9 insertions, 0 deletions
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