From 34a21483af234e67edf85b5c5cebf17375ff1606 Mon Sep 17 00:00:00 2001 From: t_max <1172915550@qq.com> Date: Mon, 22 Apr 2024 10:37:18 +0800 Subject: [PATCH] enh: override invalid parameters --- src/TMQ/WebSocket/Consumer.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/TMQ/WebSocket/Consumer.cs b/src/TMQ/WebSocket/Consumer.cs index f551ec7..2131c09 100644 --- a/src/TMQ/WebSocket/Consumer.cs +++ b/src/TMQ/WebSocket/Consumer.cs @@ -45,7 +45,14 @@ public Consumer(ConsumerBuilder builder) _autoCommit = true; if (!string.IsNullOrEmpty(_options.AutoCommitIntervalMs)) { - _autoCommitInterval = int.Parse(_options.AutoCommitIntervalMs); + try + { + _autoCommitInterval = int.Parse(_options.AutoCommitIntervalMs); + } + catch (Exception e) + { + throw new ArgumentException("Invalid auto commit interval", e); + } } else {