Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(clp-s): Improve error reporting for directory-creation failure during compression. #671

Merged
merged 3 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion components/core/src/clp_s/ArchiveWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ void ArchiveWriter::open(ArchiveWriterOption const& option) {

m_archive_path = archive_path.string();
if (false == std::filesystem::create_directory(m_archive_path, ec)) {
throw OperationFailed(ErrorCodeErrno, __FILENAME__, __LINE__);
SPDLOG_ERROR(
"Failed to create archive directory \"{}\" - ({}) {}",
m_archive_path,
ec.message(),
ec.value()
);
throw OperationFailed(ErrorCodeFailure, __FILENAME__, __LINE__);
}

std::string var_dict_path = m_archive_path + constants::cArchiveVarDictFile;
Expand Down
7 changes: 6 additions & 1 deletion components/core/src/clp_s/clp-s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,12 @@ int main(int argc, char const* argv[]) {
}

if (CommandLineArguments::Command::Compress == command_line_arguments.get_command()) {
if (false == compress(command_line_arguments)) {
try {
if (false == compress(command_line_arguments)) {
return 1;
}
} catch (std::exception const& e) {
SPDLOG_ERROR("Encountered error during compression - {}", e.what());
return 1;
}
} else if (CommandLineArguments::Command::Extract == command_line_arguments.get_command()) {
Expand Down
Loading