From 62f0e11bfa502c0e7f9e2783b52b3fded11b2d34 Mon Sep 17 00:00:00 2001 From: Huyen Chau Nguyen Date: Fri, 9 Dec 2016 14:58:20 +0100 Subject: [PATCH] assert that there is an open logger file when trying to log geojson output (#3417) --- include/util/geojson_debug_logger.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/util/geojson_debug_logger.hpp b/include/util/geojson_debug_logger.hpp index dae53dd64..226a31cf7 100644 --- a/include/util/geojson_debug_logger.hpp +++ b/include/util/geojson_debug_logger.hpp @@ -63,11 +63,11 @@ class GeojsonLogger // make sure to syncronize logging output, our writing should be sequential std::lock_guard guard(lock); - // if there is no logfile, we cannot write + // if there is no logfile, we cannot write (possible reason: the guard might be out of scope + // (e.g. if it is anonymous)) if (!ofs.is_open() || (nullptr == policy)) { - // this can only happend between two guards when concurrent writing occurs - return false; + throw util::exception("Trying to use the geojson printer without an open logger."); } // use our policy to convert the arguments into geojson, this can be done in parallel