summaryrefslogtreecommitdiffstats
path: root/src/DabMod.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-02-27 14:16:58 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-02-27 14:16:58 +0100
commit1e2a6c6e367849335fd82efb4afc827fd4fe82a6 (patch)
tree19d07a64c8bc3ccbba131ff2385fc4ec93660b14 /src/DabMod.cpp
parentb11eff2c8c913d470897e5395b240939ed46dc35 (diff)
downloaddabmod-1e2a6c6e367849335fd82efb4afc827fd4fe82a6.tar.gz
dabmod-1e2a6c6e367849335fd82efb4afc827fd4fe82a6.tar.bz2
dabmod-1e2a6c6e367849335fd82efb4afc827fd4fe82a6.zip
Create custom exception for ZMQ overflow
Diffstat (limited to 'src/DabMod.cpp')
-rw-r--r--src/DabMod.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/DabMod.cpp b/src/DabMod.cpp
index 2489797..6cf1b96 100644
--- a/src/DabMod.cpp
+++ b/src/DabMod.cpp
@@ -107,7 +107,7 @@ enum run_modulator_state {
MOD_AGAIN
};
-run_modulator_state run_modulator(modulator_data& m);
+run_modulator_state run_modulator(Logger& logger, modulator_data& m);
int main(int argc, char* argv[])
{
@@ -776,7 +776,7 @@ int main(int argc, char* argv[])
m.inputReader->PrintInfo();
- run_modulator_state st = run_modulator(m);
+ run_modulator_state st = run_modulator(logger, m);
switch (st) {
case MOD_FAILURE:
@@ -824,7 +824,7 @@ int main(int argc, char* argv[])
return ret;
}
-run_modulator_state run_modulator(modulator_data& m)
+run_modulator_state run_modulator(Logger& logger, modulator_data& m)
{
run_modulator_state ret = MOD_FAILURE;
try {
@@ -858,24 +858,24 @@ run_modulator_state run_modulator(modulator_data& m)
}
}
if (framesize == 0) {
- fprintf(stderr, "End of file reached.\n");
+ logger.level(info) << "End of file reached.";
}
else {
- fprintf(stderr, "Input read error.\n");
+ logger.level(error) << "Input read error.";
}
running = 0;
ret = MOD_NORMAL_END;
}
} catch (fct_discontinuity_error& e) {
// The OutputUHD saw a FCT discontinuity
- fprintf(stderr, "Stream discontinuity\n");
+ logger.level(warn) << e.what();
ret = MOD_AGAIN;
- } catch (std::overflow_error& e) {
+ } catch (zmq_input_overflow& e) {
// The ZeroMQ input has overflowed its buffer
- fprintf(stderr, "overflow error: %s\n", e.what());
+ logger.level(warn) << e.what();
ret = MOD_AGAIN;
} catch (std::exception& e) {
- fprintf(stderr, "EXCEPTION: %s\n", e.what());
+ logger.level(error) << "Exception caught: " << e.what();
ret = MOD_FAILURE;
}