changeset 1872:09a737a6bf36

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 07 Dec 2015 09:48:34 +0100
parents e8146c9c28a4 (current diff) a6c431193c79 (diff)
children 5e7feeb63d1f
files NEWS OrthancServer/main.cpp
diffstat 3 files changed, 35 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Mon Dec 07 09:46:37 2015 +0100
+++ b/NEWS	Mon Dec 07 09:48:34 2015 +0100
@@ -4,6 +4,7 @@
 * Fix modality worklists server if some fields are null
 * More tolerant "/series/.../ordered-slices" with broken series
 * Promiscuous mode is now turned off by default
+* Improved logging information if upgrade fails
 
 
 Version 0.9.5 (2015/12/02)
--- a/OrthancServer/ServerToolbox.cpp	Mon Dec 07 09:46:37 2015 +0100
+++ b/OrthancServer/ServerToolbox.cpp	Mon Dec 07 09:48:34 2015 +0100
@@ -322,6 +322,8 @@
             tmp != level ||
             !FindOneChildInstance(instance, database, resource, level))
         {
+          LOG(ERROR) << "Cannot find an instance for " << EnumerationToString(level) 
+                     << " with identifier " << *it;
           throw OrthancException(ErrorCode_InternalError);
         }
 
@@ -329,23 +331,33 @@
         FileInfo attachment;
         if (!database.LookupAttachment(attachment, instance, FileContentType_Dicom))
         {
+          LOG(ERROR) << "Cannot retrieve the DICOM file associated with instance " << database.GetPublicId(instance);
           throw OrthancException(ErrorCode_InternalError);
         }
 
-        // Read and parse the content of the DICOM file
-        StorageAccessor accessor(storageArea);
+        try
+        {
+          // Read and parse the content of the DICOM file
+          StorageAccessor accessor(storageArea);
 
-        std::string content;
-        accessor.Read(content, attachment);
+          std::string content;
+          accessor.Read(content, attachment);
+
+          ParsedDicomFile dicom(content);
 
-        ParsedDicomFile dicom(content);
+          // Update the tags of this resource
+          DicomMap dicomSummary;
+          dicom.Convert(dicomSummary);
 
-        // Update the tags of this resource
-        DicomMap dicomSummary;
-        dicom.Convert(dicomSummary);
-
-        database.ClearMainDicomTags(resource);
-        Toolbox::SetMainDicomTags(database, resource, level, dicomSummary);
+          database.ClearMainDicomTags(resource);
+          Toolbox::SetMainDicomTags(database, resource, level, dicomSummary);
+        }
+        catch (OrthancException&)
+        {
+          LOG(ERROR) << "Cannot decode the DICOM file with UUID " << attachment.GetUuid()
+                     << " associated with instance " << database.GetPublicId(instance);
+          throw;
+        }
       }
     }
   }
--- a/OrthancServer/main.cpp	Mon Dec 07 09:46:37 2015 +0100
+++ b/OrthancServer/main.cpp	Mon Dec 07 09:48:34 2015 +0100
@@ -835,7 +835,17 @@
 
   LOG(WARNING) << "Upgrading the database from schema version "
                << currentVersion << " to " << ORTHANC_DATABASE_VERSION;
-  database.Upgrade(ORTHANC_DATABASE_VERSION, storageArea);
+
+  try
+  {
+    database.Upgrade(ORTHANC_DATABASE_VERSION, storageArea);
+  }
+  catch (OrthancException&)
+  {
+    LOG(ERROR) << "Unable to run the automated upgrade, please use the replication instructions: "
+               << "https://orthanc.chu.ulg.ac.be/book/users/replication.html";
+    throw;
+  }
     
   // Sanity check
   currentVersion = database.GetDatabaseVersion();