Skip to content

Commit

Permalink
Address review comment by making error message even more explicit
Browse files Browse the repository at this point in the history
Signed-off-by: Emerson Knapp <[email protected]>
  • Loading branch information
Emerson Knapp committed Jan 25, 2021
1 parent aa0dbf1 commit 247c48c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ class ROSBAG2_COMPRESSION_PUBLIC SequentialCompressionWriter
/**
* Compress a file and update the metadata file path.
*
* Note: this may log an error without raising an exception in the case that the input file
* could not be deleted after compressing. This is an error and should never happen, but given
* that the desired output is created, execution will not be halted.
*
* \param compressor An initialized compression context.
* \param file_relative_to_bag Relative path of the file to compress, as stored in metadata -
* meaning the path is relative to the bag base folder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ void SequentialCompressionWriter::compress_file(

if (!rcpputils::fs::remove(file_relative_to_pwd)) {
ROSBAG2_COMPRESSION_LOG_ERROR_STREAM(
"Failed to remove uncompressed bag: \"" << file_relative_to_pwd.string() << "\"");
"Failed to remove original pre-compressed bag file: \"" <<
file_relative_to_pwd.string() << "\". This should never happen - but execution " <<
"will not be halted because the compressed output was successfully created.");
}
} else {
ROSBAG2_COMPRESSION_LOG_DEBUG_STREAM(
Expand All @@ -270,7 +272,7 @@ void SequentialCompressionWriter::split_bagfile()
std::lock_guard<std::mutex> compressor_lock(compressor_queue_mutex_);

// Grab last file before calling common splitting logic, which pushes the new filename
std::string last_file = metadata_.relative_file_paths.back();
const auto last_file = metadata_.relative_file_paths.back();

SequentialWriter::split_bagfile();

Expand Down

0 comments on commit 247c48c

Please sign in to comment.