From e06057dfd5f7a6ceaeee6e5c5ba0cb79c4c1d2d2 Mon Sep 17 00:00:00 2001 From: Manuel Pitz Date: Tue, 16 Feb 2021 11:53:42 +0100 Subject: [PATCH] change of error style --- lib/hooks/dft.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/hooks/dft.cpp b/lib/hooks/dft.cpp index c4138afa5..2bba34e11 100644 --- a/lib/hooks/dft.cpp +++ b/lib/hooks/dft.cpp @@ -239,6 +239,8 @@ public: "sync", &syncDft, "signalIndex", &jsonChannelList ); + if (ret) + throw ConfigError(cfg, err, "node-config-hook-dft"); if (jsonChannelList != nullptr) { if (jsonChannelList->type == JSON_ARRAY) { @@ -296,18 +298,14 @@ public: paddingType = paddingTypeEnum::ZERO; } - if (endFreqency < 0 || endFreqency > sampleRate) { - error("End frequency must be smaller than sampleRate (%i)",sampleRate); - ret = 1; - } + if (endFreqency < 0 || endFreqency > sampleRate) + throw ConfigError(cfg, err, "node-config-hook-dft","End frequency must be smaller than sampleRate {}",sampleRate); + + if (frequencyResolution > ((double)sampleRate/windowSize)) + throw ConfigError(cfg, err, "node-config-hook-dft","The maximum frequency resolution with smaple_rate:{} and window_site:{} is {}",sampleRate, windowSize, ((double)sampleRate/windowSize)); + - if (frequencyResolution > ((double)sampleRate/windowSize)) { - error("The maximum frequency resolution with smaple_rate:%i and window_site:%i is %f",sampleRate, windowSize, ((double)sampleRate/windowSize)); - ret = 1; - } - if (ret) - throw ConfigError(cfg, err, "node-config-hook-dft"); } virtual Hook::Reason process(sample *smp)