]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/common/errorator: add extend_ertr helper for merging errorators
authorSamuel Just <sjust@redhat.com>
Thu, 14 Jan 2021 07:40:17 +0000 (23:40 -0800)
committerSamuel Just <sjust@redhat.com>
Mon, 1 Feb 2021 20:48:39 +0000 (12:48 -0800)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/common/errorator.h

index af1e6ea45c8e701023627cceebc64914ec7b4303..746bd9bb51de51091411887fa6506c8bf95e6b22 100644 (file)
@@ -776,7 +776,7 @@ public:
     return all_same_way_t<ErrorFunc>{std::forward<ErrorFunc>(error_func)};
   };
 
-  // get a new errorator by extending current one with new error
+  // get a new errorator by extending current one with new errors
   template <class... NewAllowedErrorsT>
   using extend = errorator<AllowedErrors..., NewAllowedErrorsT...>;
 
@@ -813,6 +813,10 @@ public:
     using type = errorator<AllowedErrors...>;
   };
 
+  // get a new errorator by extending current one with another errorator
+  template <class E>
+  using extend_ertr = typename unify<E>::type;
+
   template <typename T=void, typename... A>
   static future<T> make_ready_future(A&&... value) {
     return future<T>(ready_future_marker(), std::forward<A>(value)...);
@@ -953,10 +957,14 @@ public:
   template <class T>
   using futurize = ::seastar::futurize<T>;
 
-  // get a new errorator by extending current one with new error
+  // get a new errorator by extending current one with errors
   template <class... NewAllowedErrors>
   using extend = errorator<NewAllowedErrors...>;
 
+  // get a new errorator by extending current one with another errorator
+  template <class E>
+  using extend_ertr = E;
+
   // errorator with empty error set never contains any error
   template <class T>
   static constexpr bool contains_once_v = false;