diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-08-21 17:34:57 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-08-21 17:34:57 +0200 |
commit | f8fc81a5c9fcd986473797df9286c6c9fef683bf (patch) | |
tree | d81b4a0c456f776bd40725efa372e81441d88196 /libbutl/utility.mxx | |
parent | 338a16f0df3c45bcbeaf5e7ffd0b4dc515e11502 (diff) |
Add utility functions for throwing ios::failure
Diffstat (limited to 'libbutl/utility.mxx')
-rw-r--r-- | libbutl/utility.mxx | 9 |
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 |