diff Plugins/Engine/OrthancPluginDatabase.cpp @ 1646:da799f767e5d

simplification in error casting with plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 24 Sep 2015 16:01:09 +0200
parents eb8fbcf008b5
children 2e692c83e2f3
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPluginDatabase.cpp	Thu Sep 24 15:55:17 2015 +0200
+++ b/Plugins/Engine/OrthancPluginDatabase.cpp	Thu Sep 24 16:01:09 2015 +0200
@@ -236,7 +236,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -248,7 +248,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -259,7 +259,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -270,7 +270,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -284,7 +284,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     return id;
@@ -298,7 +298,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -310,7 +310,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -321,7 +321,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -357,7 +357,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     ForwardAnswers(target);
@@ -379,7 +379,7 @@
 
       if (error != OrthancPluginErrorCode_Success)
       {
-        throw OrthancException(Plugins::Convert(error));
+        throw OrthancException(static_cast<ErrorCode>(error));
       }
 
       ForwardAnswers(target);
@@ -432,7 +432,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -446,7 +446,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     ForwardAnswers(target);
@@ -462,7 +462,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     ForwardAnswers(target);
@@ -483,7 +483,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -500,7 +500,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -517,7 +517,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -532,7 +532,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -546,7 +546,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
     
     if (!ForwardSingleAnswer(s))
@@ -566,7 +566,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     return count;
@@ -581,7 +581,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     return Convert(type);
@@ -596,7 +596,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     return size;
@@ -611,7 +611,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     return size;
@@ -626,7 +626,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     return (existing != 0);
@@ -641,7 +641,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     return (isProtected != 0);
@@ -657,7 +657,7 @@
  
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     if (type_ != _OrthancPluginDatabaseAnswerType_None &&
@@ -688,7 +688,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     if (type_ != _OrthancPluginDatabaseAnswerType_None &&
@@ -724,7 +724,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -746,7 +746,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -762,7 +762,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     if (type_ == _OrthancPluginDatabaseAnswerType_None)
@@ -792,7 +792,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     return ForwardSingleAnswer(target);
@@ -814,7 +814,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     ForwardAnswers(target);
@@ -830,7 +830,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     ForwardAnswers(target);
@@ -847,7 +847,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     return ForwardSingleAnswer(target);
@@ -863,7 +863,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     return ForwardSingleAnswer(parentId);
@@ -880,7 +880,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     if (type_ == _OrthancPluginDatabaseAnswerType_None)
@@ -909,7 +909,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     return ForwardSingleAnswer(internalId);
@@ -925,7 +925,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
 
     return ForwardSingleAnswer(internalId);
@@ -940,7 +940,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -967,7 +967,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -981,7 +981,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -993,7 +993,7 @@
 
     if (error != OrthancPluginErrorCode_Success)
     {
-      throw OrthancException(Plugins::Convert(error));
+      throw OrthancException(static_cast<ErrorCode>(error));
     }
   }
 
@@ -1018,7 +1018,7 @@
 
       if (error != OrthancPluginErrorCode_Success)
       {
-        throw OrthancException(Plugins::Convert(error));
+        throw OrthancException(static_cast<ErrorCode>(error));
       }
     }
 
@@ -1028,7 +1028,7 @@
 
       if (error != OrthancPluginErrorCode_Success)
       {
-        throw OrthancException(Plugins::Convert(error));
+        throw OrthancException(static_cast<ErrorCode>(error));
       }
     }
 
@@ -1038,7 +1038,7 @@
 
       if (error != OrthancPluginErrorCode_Success)
       {
-        throw OrthancException(Plugins::Convert(error));
+        throw OrthancException(static_cast<ErrorCode>(error));
       }
     }
   };
@@ -1093,7 +1093,7 @@
 
       if (error != OrthancPluginErrorCode_Success)
       {
-        throw OrthancException(Plugins::Convert(error));
+        throw OrthancException(static_cast<ErrorCode>(error));
       }
 
       return version;
@@ -1119,7 +1119,7 @@
 
       if (error != OrthancPluginErrorCode_Success)
       {
-        throw OrthancException(Plugins::Convert(error));
+        throw OrthancException(static_cast<ErrorCode>(error));
       }
     }
   }