From 6e076810a072bda352d83e95c6b5011c6020a7ed Mon Sep 17 00:00:00 2001 From: Alexander Damian Date: Fri, 26 Apr 2019 11:12:52 -0400 Subject: [PATCH] Added ActionTerminatedException to BackoffPerformer --- include/cppkafka/exceptions.h | 8 ++++++++ include/cppkafka/utils/backoff_performer.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/cppkafka/exceptions.h b/include/cppkafka/exceptions.h index 8bfd801..c882b41 100644 --- a/include/cppkafka/exceptions.h +++ b/include/cppkafka/exceptions.h @@ -134,6 +134,14 @@ private: Error error_; }; +/** + * Backoff performer has no more retries left for a specific action. + */ +class CPPKAFKA_API ActionTerminatedException : public Exception { +public: + ActionTerminatedException(const std::string& error); +}; + } // cppkafka #endif // CPPKAFKA_EXCEPTIONS_H diff --git a/include/cppkafka/utils/backoff_performer.h b/include/cppkafka/utils/backoff_performer.h index 7ffdc89..0a66a96 100644 --- a/include/cppkafka/utils/backoff_performer.h +++ b/include/cppkafka/utils/backoff_performer.h @@ -136,7 +136,7 @@ public: backoff = increase_backoff(backoff); } // No more retries left or we have a terminal error. - throw Exception("Commit failed: no more retries."); + throw ActionTerminatedException("Commit failed: no more retries."); } private: TimeUnit increase_backoff(TimeUnit backoff);