changeset 234:083d0cbcbac4 transcoding

improved error message
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 11 May 2020 16:02:34 +0200
parents e866849335fd
children 85b6a8bf8c7b
files Plugin/DecodedImageAdapter.cpp WebApplication/viewer.js
diffstat 2 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Plugin/DecodedImageAdapter.cpp	Mon May 11 15:38:39 2020 +0200
+++ b/Plugin/DecodedImageAdapter.cpp	Mon May 11 16:02:34 2020 +0200
@@ -125,8 +125,7 @@
   bool DecodedImageAdapter::Create(std::string& content,
                                    const std::string& uri)
   {
-    std::string message = "Decoding DICOM instance: " + uri;
-    OrthancPluginLogInfo(context_, message.c_str());
+    LOG(INFO) << "Decoding DICOM instance: " << uri;
 
     CompressionType type;
     uint8_t level;
@@ -138,7 +137,6 @@
       return false;
     }
 
-
     bool ok = false;
 
     Json::Value tags;
@@ -180,9 +178,7 @@
     }
     else
     {
-      char msg[1024];
-      sprintf(msg, "Unable to decode the following instance: %s", uri.c_str());
-      OrthancPluginLogWarning(context_, msg);
+      LOG(WARNING) << "Unable to decode the following instance: " << uri;
       return false;
     }
   }
--- a/WebApplication/viewer.js	Mon May 11 15:38:39 2020 +0200
+++ b/WebApplication/viewer.js	Mon May 11 16:02:34 2020 +0200
@@ -23,6 +23,7 @@
 var compression = 'jpeg95';
 var isFirst = true;
 //var compression = 'deflate';
+var unsupportedMessage = 'Error: The Orthanc core does not support the decoding of this image. Make sure that you have properly installed a suitable decoder plugin (e.g. the official GDCM decoder plugin).';
 
 
 // Prevent the access to IE
@@ -383,7 +384,7 @@
         result = image;
       },
       error: function() {
-        alert('Error: This image is not supported by the Web viewer.');
+        alert(unsupportedMessage);
         return null;
       }
     });
@@ -430,7 +431,7 @@
       }
     },
     failure: function() {
-      alert('Error: This image is not supported by the Web viewer.');
+      alert(unsupportedMessage);
     }
   });