diff --git a/broker/JFJochServices.cpp b/broker/JFJochServices.cpp index 1d30ed54..b5913a81 100644 --- a/broker/JFJochServices.cpp +++ b/broker/JFJochServices.cpp @@ -122,6 +122,14 @@ JFJochServicesOutput JFJochServices::Stop() { ret.receiver_output.received_packets[i], ret.receiver_output.expected_packets[i]); } } + + // A writer that broke mid-run (e.g. a lost connection) leaves a truncated file. + // Surface that as a failed acquisition instead of silently reporting success. + if (!ret.receiver_output.writer_err.empty()) + throw JFJochException(JFJochExceptionCategory::FileWriteError, + "Writer error, written data may be incomplete: " + + ret.receiver_output.writer_err); + logger.Info(" ... finished with success"); } catch (const JFJochException &e) { logger.Error(" ... finished with error {}", e.what());