changeset 2133:15ae532af70e

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 09 Nov 2016 10:21:37 +0100
parents a43708636890
children ddc75c6c712d
files Core/Enumerations.cpp Core/Enumerations.h Core/HttpServer/MongooseServer.cpp OrthancServer/main.cpp Plugins/Include/orthanc/OrthancCPlugin.h Resources/ErrorCodes.json
diffstat 6 files changed, 11 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Enumerations.cpp	Wed Nov 09 10:19:53 2016 +0100
+++ b/Core/Enumerations.cpp	Wed Nov 09 10:21:37 2016 +0100
@@ -64,7 +64,7 @@
         return "Parameter out of range";
 
       case ErrorCode_NotEnoughMemory:
-        return "Not enough memory";
+        return "The server hosting Orthanc is running out of memory";
 
       case ErrorCode_BadParameterType:
         return "Bad type for a parameter";
@@ -156,9 +156,6 @@
       case ErrorCode_NotAcceptable:
         return "Cannot send a response which is acceptable according to the Accept HTTP header";
 
-      case ErrorCode_NotEnoughMemory:
-        return "The server hosting Orthanc is running out of memory";
-
       case ErrorCode_NullPointer:
         return "Cannot handle a NULL pointer";
 
--- a/Core/Enumerations.h	Wed Nov 09 10:19:53 2016 +0100
+++ b/Core/Enumerations.h	Wed Nov 09 10:21:37 2016 +0100
@@ -52,7 +52,7 @@
     ErrorCode_Plugin = 1    /*!< Error encountered within the plugin engine */,
     ErrorCode_NotImplemented = 2    /*!< Not implemented yet */,
     ErrorCode_ParameterOutOfRange = 3    /*!< Parameter out of range */,
-    ErrorCode_NotEnoughMemory = 4    /*!< Not enough memory */,
+    ErrorCode_NotEnoughMemory = 4    /*!< The server hosting Orthanc is running out of memory */,
     ErrorCode_BadParameterType = 5    /*!< Bad type for a parameter */,
     ErrorCode_BadSequenceOfCalls = 6    /*!< Bad sequence of calls */,
     ErrorCode_InexistentItem = 7    /*!< Accessing an inexistent item */,
@@ -83,8 +83,7 @@
     ErrorCode_StorageAreaPlugin = 32    /*!< Error in the plugin implementing a custom storage area */,
     ErrorCode_EmptyRequest = 33    /*!< The request is empty */,
     ErrorCode_NotAcceptable = 34    /*!< Cannot send a response which is acceptable according to the Accept HTTP header */,
-    ErrorCode_NotEnoughMemory = 35    /*!< The server hosting Orthanc is running out of memory */,
-    ErrorCode_NullPointer = 36    /*!< Cannot handle a NULL pointer */,
+    ErrorCode_NullPointer = 35    /*!< Cannot handle a NULL pointer */,
     ErrorCode_SQLiteNotOpened = 1000    /*!< SQLite: The database is not opened */,
     ErrorCode_SQLiteAlreadyOpened = 1001    /*!< SQLite: Connection is already open */,
     ErrorCode_SQLiteCannotOpen = 1002    /*!< SQLite: Unable to open the database */,
--- a/Core/HttpServer/MongooseServer.cpp	Wed Nov 09 10:19:53 2016 +0100
+++ b/Core/HttpServer/MongooseServer.cpp	Wed Nov 09 10:21:37 2016 +0100
@@ -744,6 +744,10 @@
         // Presumably an error while parsing the JSON body
         throw OrthancException(ErrorCode_BadRequest);
       }
+      /*catch (std::bad_alloc&)
+      {
+        throw OrthancException(ErrorCode_NotEnoughMemory);
+        }*/
 
       if (!found)
       {
--- a/OrthancServer/main.cpp	Wed Nov 09 10:19:53 2016 +0100
+++ b/OrthancServer/main.cpp	Wed Nov 09 10:21:37 2016 +0100
@@ -504,7 +504,7 @@
     PrintErrorCode(ErrorCode_Plugin, "Error encountered within the plugin engine");
     PrintErrorCode(ErrorCode_NotImplemented, "Not implemented yet");
     PrintErrorCode(ErrorCode_ParameterOutOfRange, "Parameter out of range");
-    PrintErrorCode(ErrorCode_NotEnoughMemory, "Not enough memory");
+    PrintErrorCode(ErrorCode_NotEnoughMemory, "The server hosting Orthanc is running out of memory");
     PrintErrorCode(ErrorCode_BadParameterType, "Bad type for a parameter");
     PrintErrorCode(ErrorCode_BadSequenceOfCalls, "Bad sequence of calls");
     PrintErrorCode(ErrorCode_InexistentItem, "Accessing an inexistent item");
@@ -535,7 +535,6 @@
     PrintErrorCode(ErrorCode_StorageAreaPlugin, "Error in the plugin implementing a custom storage area");
     PrintErrorCode(ErrorCode_EmptyRequest, "The request is empty");
     PrintErrorCode(ErrorCode_NotAcceptable, "Cannot send a response which is acceptable according to the Accept HTTP header");
-    PrintErrorCode(ErrorCode_NotEnoughMemory, "The server hosting Orthanc is running out of memory");
     PrintErrorCode(ErrorCode_NullPointer, "Cannot handle a NULL pointer");
     PrintErrorCode(ErrorCode_SQLiteNotOpened, "SQLite: The database is not opened");
     PrintErrorCode(ErrorCode_SQLiteAlreadyOpened, "SQLite: Connection is already open");
--- a/Plugins/Include/orthanc/OrthancCPlugin.h	Wed Nov 09 10:19:53 2016 +0100
+++ b/Plugins/Include/orthanc/OrthancCPlugin.h	Wed Nov 09 10:21:37 2016 +0100
@@ -191,7 +191,7 @@
     OrthancPluginErrorCode_Plugin = 1    /*!< Error encountered within the plugin engine */,
     OrthancPluginErrorCode_NotImplemented = 2    /*!< Not implemented yet */,
     OrthancPluginErrorCode_ParameterOutOfRange = 3    /*!< Parameter out of range */,
-    OrthancPluginErrorCode_NotEnoughMemory = 4    /*!< Not enough memory */,
+    OrthancPluginErrorCode_NotEnoughMemory = 4    /*!< The server hosting Orthanc is running out of memory */,
     OrthancPluginErrorCode_BadParameterType = 5    /*!< Bad type for a parameter */,
     OrthancPluginErrorCode_BadSequenceOfCalls = 6    /*!< Bad sequence of calls */,
     OrthancPluginErrorCode_InexistentItem = 7    /*!< Accessing an inexistent item */,
@@ -222,8 +222,7 @@
     OrthancPluginErrorCode_StorageAreaPlugin = 32    /*!< Error in the plugin implementing a custom storage area */,
     OrthancPluginErrorCode_EmptyRequest = 33    /*!< The request is empty */,
     OrthancPluginErrorCode_NotAcceptable = 34    /*!< Cannot send a response which is acceptable according to the Accept HTTP header */,
-    OrthancPluginErrorCode_NotEnoughMemory = 35    /*!< The server hosting Orthanc is running out of memory */,
-    OrthancPluginErrorCode_NullPointer = 36    /*!< Cannot handle a NULL pointer */,
+    OrthancPluginErrorCode_NullPointer = 35    /*!< Cannot handle a NULL pointer */,
     OrthancPluginErrorCode_SQLiteNotOpened = 1000    /*!< SQLite: The database is not opened */,
     OrthancPluginErrorCode_SQLiteAlreadyOpened = 1001    /*!< SQLite: Connection is already open */,
     OrthancPluginErrorCode_SQLiteCannotOpen = 1002    /*!< SQLite: Unable to open the database */,
--- a/Resources/ErrorCodes.json	Wed Nov 09 10:19:53 2016 +0100
+++ b/Resources/ErrorCodes.json	Wed Nov 09 10:21:37 2016 +0100
@@ -32,7 +32,7 @@
   {
     "Code": 4, 
     "Name": "NotEnoughMemory", 
-    "Description": "Not enough memory"
+    "Description": "The server hosting Orthanc is running out of memory"
   }, 
   {
     "Code": 5, 
@@ -198,11 +198,6 @@
   }, 
   {
     "Code": 35, 
-    "Name": "NotEnoughMemory", 
-    "Description": "The server hosting Orthanc is running out of memory"
-  }, 
-  {
-    "Code": 36, 
     "Name": "NullPointer", 
     "Description": "Cannot handle a NULL pointer"
   },