]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/common: print std::exception_ptr after conveting it to exception
authorKefu Chai <tchaikov@gmail.com>
Tue, 22 Nov 2022 03:41:43 +0000 (11:41 +0800)
committerKefu Chai <tchaikov@gmail.com>
Tue, 22 Nov 2022 05:54:41 +0000 (13:54 +0800)
fmt does not support formatting `std::exception_ptr`, so we need to
rethrow it, so we can convert it to a known exception type.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/crimson/common/gated.h

index 7d901b6b1a912687bb51a6804866dab69cbb990e..559a889a3e238fd68ee291320d8a3b57f702f503 100644 (file)
@@ -31,8 +31,12 @@ class Gated {
            "{}, {} skipped, system shutdown", who, what);
        return;
       }
-      gated_logger().error(
-          "{} dispatch() {} caught exception: {}", who, what, eptr);
+      try {
+       std::rethrow_exception(eptr);
+      } catch (std::exception& e) {
+       gated_logger().error(
+          "{} dispatch() {} caught exception: {}", who, what, e.what());
+      }
       assert(*eptr.__cxa_exception_type()
        == typeid(seastar::gate_closed_exception));
     });