aboutsummaryrefslogtreecommitdiff
path: root/butl/utility
diff options
context:
space:
mode:
Diffstat (limited to 'butl/utility')
-rw-r--r--butl/utility15
1 files changed, 14 insertions, 1 deletions
diff --git a/butl/utility b/butl/utility
index f668ecc..ac94171 100644
--- a/butl/utility
+++ b/butl/utility
@@ -6,10 +6,11 @@
#define BUTL_UTILITY
#include <string>
+#include <iosfwd> // ostream
#include <cstddef> // size_t
#include <utility> // move(), forward()
#include <cstring> // strcmp(), strlen()
-#include <exception> // uncaught_exception(s)()
+#include <exception> // exception, uncaught_exception(s)()
//#include <functional> // hash
#include <butl/export>
@@ -227,6 +228,18 @@ namespace butl
#endif
}
+namespace std
+{
+ // Sanitize the exception description before printing. This includes:
+ //
+ // - stripping leading colons and spaces (see fdstream.cxx)
+ // - stripping trailing newlines, periods, and spaces
+ // - lower-case the first letter if the beginning looks like a word
+ //
+ LIBBUTL_EXPORT ostream&
+ operator<< (ostream&, const exception&);
+}
+
#include <butl/utility.ixx>
#endif // BUTL_UTILITY