comparison OrthancServer/ServerToolbox.cpp @ 1870:a6c431193c79

Improved logging information if upgrade fails
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 05 Dec 2015 12:45:19 +0100
parents c7d70f659190
children b1291df2f780
comparison
equal deleted inserted replaced
1869:9af3b492b010 1870:a6c431193c79
320 320
321 if (!database.LookupResource(resource, tmp, *it) || 321 if (!database.LookupResource(resource, tmp, *it) ||
322 tmp != level || 322 tmp != level ||
323 !FindOneChildInstance(instance, database, resource, level)) 323 !FindOneChildInstance(instance, database, resource, level))
324 { 324 {
325 LOG(ERROR) << "Cannot find an instance for " << EnumerationToString(level)
326 << " with identifier " << *it;
325 throw OrthancException(ErrorCode_InternalError); 327 throw OrthancException(ErrorCode_InternalError);
326 } 328 }
327 329
328 // Get the DICOM file attached to some instances in the resource 330 // Get the DICOM file attached to some instances in the resource
329 FileInfo attachment; 331 FileInfo attachment;
330 if (!database.LookupAttachment(attachment, instance, FileContentType_Dicom)) 332 if (!database.LookupAttachment(attachment, instance, FileContentType_Dicom))
331 { 333 {
334 LOG(ERROR) << "Cannot retrieve the DICOM file associated with instance " << database.GetPublicId(instance);
332 throw OrthancException(ErrorCode_InternalError); 335 throw OrthancException(ErrorCode_InternalError);
333 } 336 }
334 337
335 // Read and parse the content of the DICOM file 338 try
336 StorageAccessor accessor(storageArea); 339 {
337 340 // Read and parse the content of the DICOM file
338 std::string content; 341 StorageAccessor accessor(storageArea);
339 accessor.Read(content, attachment); 342
340 343 std::string content;
341 ParsedDicomFile dicom(content); 344 accessor.Read(content, attachment);
342 345
343 // Update the tags of this resource 346 ParsedDicomFile dicom(content);
344 DicomMap dicomSummary; 347
345 dicom.Convert(dicomSummary); 348 // Update the tags of this resource
346 349 DicomMap dicomSummary;
347 database.ClearMainDicomTags(resource); 350 dicom.Convert(dicomSummary);
348 Toolbox::SetMainDicomTags(database, resource, level, dicomSummary); 351
352 database.ClearMainDicomTags(resource);
353 Toolbox::SetMainDicomTags(database, resource, level, dicomSummary);
354 }
355 catch (OrthancException&)
356 {
357 LOG(ERROR) << "Cannot decode the DICOM file with UUID " << attachment.GetUuid()
358 << " associated with instance " << database.GetPublicId(instance);
359 throw;
360 }
349 } 361 }
350 } 362 }
351 } 363 }
352 } 364 }