diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-01-06 03:26:03 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-01-09 21:31:14 +0300 |
commit | 9a81c308f2d4217592630ef41a18a8998bd66f5c (patch) | |
tree | e5ab252f90d1b3aa2a2f2775f0f36e569d48b4a5 /butl/fdstream.cxx | |
parent | 39101a4383d38c1217c44b999a6e3bd199727c60 (diff) |
Add operator<<(ostream, exception)
Diffstat (limited to 'butl/fdstream.cxx')
-rw-r--r-- | butl/fdstream.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/butl/fdstream.cxx b/butl/fdstream.cxx index 2eee7c5..370a75e 100644 --- a/butl/fdstream.cxx +++ b/butl/fdstream.cxx @@ -46,18 +46,22 @@ namespace butl // exception and to make a string returned by what() to contain the error // description plus an optional custom message if provided. Unfortunatelly // there is no way to say that the custom message is absent. Passing an - // empty string results for GCC (as of version 5.3.1) with a description - // like this (note the ugly ": " prefix): ": No such file or directory". + // empty string results for libstdc++ (as of version 5.3.1) with a + // description like this (note the ': ' prefix): + // + // : No such file or directory + // + // Note that our custom operator<<(ostream, exception) strips this prefix. // throw ios_base::failure (m != nullptr ? m : "", e); } template <bool v> static inline void - throw_ios_failure (error_code ec, + throw_ios_failure (error_code e, typename enable_if<!v, const char*>::type m) { - throw ios_base::failure (m != nullptr ? m : ec.message ().c_str ()); + throw ios_base::failure (m != nullptr ? m : e.message ().c_str ()); } inline void |