This is an automated email from the ASF dual-hosted git repository.

bneradt pushed a commit to branch training
in repository https://gitbox.apache.org/repos/asf/trafficserver-libswoc.git

commit b0d07134b706c446228e7bd6c41a5d85db0d90ee
Author: Alan M. Carroll <[email protected]>
AuthorDate: Mon Jun 7 06:06:45 2021 -0500

    BWF: Add support for std::error_code.
---
 code/src/bw_format.cc     | 4 +---
 doc/code/BW_Format.en.rst | 7 +++++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/code/src/bw_format.cc b/code/src/bw_format.cc
index afa3126..89e4dd8 100644
--- a/code/src/bw_format.cc
+++ b/code/src/bw_format.cc
@@ -837,10 +837,8 @@ operator<<(ostream &s, swoc::FixedBufferWriter &w)
 swoc::BufferWriter &
 bwformat(swoc::BufferWriter &w, swoc::bwf::Spec const &spec, error_code const 
&ec)
 {
-  // This provides convenient safe access to the errno short name array.
   static const swoc::bwf::Format number_fmt{"[{}]"_sv}; // numeric value 
format.
-  if (spec.has_numeric_type()) {                        // if numeric type, 
print just the numeric
-    // part.
+  if (spec.has_numeric_type()) { // only the number
     w.print(number_fmt, ec.value());
   } else {
     w.write(ec.message());
diff --git a/doc/code/BW_Format.en.rst b/doc/code/BW_Format.en.rst
index d8a1e81..991c369 100644
--- a/doc/code/BW_Format.en.rst
+++ b/doc/code/BW_Format.en.rst
@@ -533,6 +533,13 @@ Specific types
         bw.print("{:>20: =a}",addr); // -> "     172. 19.  3.105"
       }
 
+:code:`std::error_code`
+   :code:`#include "swoc/bwf_std.h"
+
+   Formatting for :code:`std::error_code`. Generically the formatted output is 
the description and
+   the numeric value. A format type of ``d`` will generate the numeric value, 
while a format type of
+   ``s`` will generate the description.
+
 Format Classes
 --------------
 

Reply via email to