comparison Core/Compression/ZipWriter.cpp @ 3184:5d1f5984dc41

improved log
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 01 Feb 2019 09:28:12 +0100
parents 6fd38327e777
children 94f4a18a79cc
comparison
equal deleted inserted replaced
3183:98187ab5a4c9 3184:5d1f5984dc41
146 pimpl_->file_ = zipOpen(path_.c_str(), mode); 146 pimpl_->file_ = zipOpen(path_.c_str(), mode);
147 } 147 }
148 148
149 if (!pimpl_->file_) 149 if (!pimpl_->file_)
150 { 150 {
151 LOG(ERROR) << "Cannot create new ZIP archive: " << path_; 151 throw OrthancException(ErrorCode_CannotWriteFile,
152 throw OrthancException(ErrorCode_CannotWriteFile); 152 "Cannot create new ZIP archive: " + path_);
153 } 153 }
154 } 154 }
155 155
156 void ZipWriter::SetOutputPath(const char* path) 156 void ZipWriter::SetOutputPath(const char* path)
157 { 157 {
208 compressionLevel_); 208 compressionLevel_);
209 } 209 }
210 210
211 if (result != 0) 211 if (result != 0)
212 { 212 {
213 LOG(ERROR) << "Cannot add new file inside ZIP archive: " << path; 213 throw OrthancException(ErrorCode_CannotWriteFile,
214 throw OrthancException(ErrorCode_CannotWriteFile); 214 "Cannot add new file inside ZIP archive: " + std::string(path));
215 } 215 }
216 216
217 hasFileInZip_ = true; 217 hasFileInZip_ = true;
218 } 218 }
219 219
240 { 240 {
241 int bytes = static_cast<int32_t>(length <= maxBytesInAStep ? length : maxBytesInAStep); 241 int bytes = static_cast<int32_t>(length <= maxBytesInAStep ? length : maxBytesInAStep);
242 242
243 if (zipWriteInFileInZip(pimpl_->file_, data, bytes)) 243 if (zipWriteInFileInZip(pimpl_->file_, data, bytes))
244 { 244 {
245 LOG(ERROR) << "Cannot write data to ZIP archive: " << path_; 245 throw OrthancException(ErrorCode_CannotWriteFile,
246 throw OrthancException(ErrorCode_CannotWriteFile); 246 "Cannot write data to ZIP archive: " + path_);
247 } 247 }
248 248
249 data += bytes; 249 data += bytes;
250 length -= bytes; 250 length -= bytes;
251 } 251 }