GunChleoc has proposed merging lp:~widelands-dev/widelands/zip_file_error_messages into lp:widelands.
Commit message: Added file and zip file paths to exceptions in ZipFilesystem. Requested reviews: Widelands Developers (widelands-dev) For more details, see: https://code.launchpad.net/~widelands-dev/widelands/zip_file_error_messages/+merge/285711 Added file and zip file paths to exceptions in ZipFilesystem. -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/zip_file_error_messages into lp:widelands.
=== modified file 'src/io/filesystem/zip_filesystem.cc' --- src/io/filesystem/zip_filesystem.cc 2016-02-06 15:58:10 +0000 +++ src/io/filesystem/zip_filesystem.cc 2016-02-11 12:26:37 +0000 @@ -251,10 +251,15 @@ */ FileSystem * ZipFilesystem::make_sub_file_system(const std::string & path) { if (!file_exists(path)) { - throw wexception("ZipFilesystem::make_sub_file_system: The path does not exist."); + throw wexception("ZipFilesystem::make_sub_file_system: The path '%s' does not exist in zip file '%s'.", + path.c_str(), + zip_file_->path().c_str()); } if (!is_directory(path)) { - throw wexception("ZipFilesystem::make_sub_file_system: The path needs to be a directory."); + throw wexception("ZipFilesystem::make_sub_file_system: " + "The path '%s' needs to be a directory in zip file '%s'.", + path.c_str(), + zip_file_->path().c_str()); } std::string localpath = path; @@ -431,10 +436,11 @@ break; case ZIP_ERRNO: throw FileError - ("ZipFilesystem::write", complete_filename, strerror(errno)); + ("ZipFilesystem::write", complete_filename, + (boost::format("in path '%s'', Error") % zip_file_->path() % strerror(errno)).str()); default: throw FileError - ("ZipFilesystem::write", complete_filename); + ("ZipFilesystem::write", complete_filename, (boost::format("in path '%s'") % zip_file_->path()).str()); } zipCloseFileInZip(zip_file_->write_handle()); @@ -512,10 +518,10 @@ { int copied = unzReadCurrentFile(zip_file_->read_handle(), read_data, bufsize); if (copied < 0) { - throw new DataError("Failed to read from zip file"); + throw new DataError("Failed to read from zip file %s", zip_file_->path().c_str()); } if (copied == 0) { - throw new DataError("End of file reaced while reading zip"); + throw new DataError("End of file reaced while reading zip %s", zip_file_->path().c_str()); } return copied; } @@ -539,6 +545,6 @@ case ZIP_OK: break; default: - throw wexception("Failed to write into zipfile"); + throw wexception("Failed to write into zipfile %S", zip_file_->path().c_str()); } }
_______________________________________________ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp