# HG changeset patch # User Sebastien Jodogne # Date 1478695353 -3600 # Node ID cadfe0a2a3936b59dc73ebe529f1e5b85b567ff5 # Parent ddc75c6c712d40dd258d01753f30f7b0bc9b8db6 fix in the sample basic plugin diff -r ddc75c6c712d -r cadfe0a2a393 OrthancServer/ServerContext.cpp --- a/OrthancServer/ServerContext.cpp Wed Nov 09 12:04:09 2016 +0100 +++ b/OrthancServer/ServerContext.cpp Wed Nov 09 13:42:33 2016 +0100 @@ -102,7 +102,8 @@ catch (OrthancException& e) { LOG(ERROR) << "Error in the " << it->GetDescription() - << " callback while signaling a change: " << e.What(); + << " callback while signaling a change: " << e.What() + << " (code " << e.GetErrorCode() << ")"; } } } @@ -222,7 +223,8 @@ catch (OrthancException& e) { LOG(ERROR) << "Error in the " << it->GetDescription() - << " callback while receiving an instance: " << e.What(); + << " callback while receiving an instance: " << e.What() + << " (code " << e.GetErrorCode() << ")"; throw; } } @@ -299,7 +301,8 @@ catch (OrthancException& e) { LOG(ERROR) << "Error in the " << it->GetDescription() - << " callback while receiving an instance: " << e.What(); + << " callback while receiving an instance: " << e.What() + << " (code " << e.GetErrorCode() << ")"; } } } diff -r ddc75c6c712d -r cadfe0a2a393 Plugins/Engine/OrthancPlugins.cpp --- a/Plugins/Engine/OrthancPlugins.cpp Wed Nov 09 12:04:09 2016 +0100 +++ b/Plugins/Engine/OrthancPlugins.cpp Wed Nov 09 13:42:33 2016 +0100 @@ -940,7 +940,7 @@ } else { - GetErrorDictionary().LogError(error, true); + GetErrorDictionary().LogError(error, false); throw OrthancException(static_cast(error)); } } diff -r ddc75c6c712d -r cadfe0a2a393 Plugins/Samples/Basic/Plugin.c --- a/Plugins/Samples/Basic/Plugin.c Wed Nov 09 12:04:09 2016 +0100 +++ b/Plugins/Samples/Basic/Plugin.c Wed Nov 09 13:42:33 2016 +0100 @@ -28,9 +28,9 @@ static OrthancPluginErrorCode customError; -ORTHANC_PLUGINS_API int32_t Callback1(OrthancPluginRestOutput* output, - const char* url, - const OrthancPluginHttpRequest* request) +ORTHANC_PLUGINS_API OrthancPluginErrorCode Callback1(OrthancPluginRestOutput* output, + const char* url, + const OrthancPluginHttpRequest* request) { char buffer[1024]; uint32_t i; @@ -57,7 +57,7 @@ OrthancPluginLogWarning(context, buffer); } - OrthancPluginLogWarning(context, ""); + OrthancPluginLogWarning(context, ""); for (i = 0; i < request->headersCount; i++) { @@ -67,13 +67,13 @@ OrthancPluginLogWarning(context, ""); - return 1; + return OrthancPluginErrorCode_Success; } -ORTHANC_PLUGINS_API int32_t Callback2(OrthancPluginRestOutput* output, - const char* url, - const OrthancPluginHttpRequest* request) +ORTHANC_PLUGINS_API OrthancPluginErrorCode Callback2(OrthancPluginRestOutput* output, + const char* url, + const OrthancPluginHttpRequest* request) { /* Answer with a sample 16bpp image. */ @@ -99,13 +99,13 @@ 256, 256, sizeof(uint16_t) * 256, buffer); } - return 0; + return OrthancPluginErrorCode_Success; } -ORTHANC_PLUGINS_API int32_t Callback3(OrthancPluginRestOutput* output, - const char* url, - const OrthancPluginHttpRequest* request) +ORTHANC_PLUGINS_API OrthancPluginErrorCode Callback3(OrthancPluginRestOutput* output, + const char* url, + const OrthancPluginHttpRequest* request) { if (request->method != OrthancPluginHttpMethod_Get) { @@ -124,13 +124,13 @@ } } - return 0; + return OrthancPluginErrorCode_Success; } -ORTHANC_PLUGINS_API int32_t Callback4(OrthancPluginRestOutput* output, - const char* url, - const OrthancPluginHttpRequest* request) +ORTHANC_PLUGINS_API OrthancPluginErrorCode Callback4(OrthancPluginRestOutput* output, + const char* url, + const OrthancPluginHttpRequest* request) { /* Answer with a sample 8bpp image. */ @@ -156,13 +156,13 @@ 256, 256, 256, buffer); } - return 0; + return OrthancPluginErrorCode_Success; } -ORTHANC_PLUGINS_API int32_t Callback5(OrthancPluginRestOutput* output, - const char* url, - const OrthancPluginHttpRequest* request) +ORTHANC_PLUGINS_API OrthancPluginErrorCode Callback5(OrthancPluginRestOutput* output, + const char* url, + const OrthancPluginHttpRequest* request) { /** * Demonstration the difference between the @@ -199,13 +199,13 @@ if (error) { - return -1; + return OrthancPluginErrorCode_InternalError; } else { OrthancPluginAnswerBuffer(context, output, tmp.data, tmp.size, "application/octet-stream"); OrthancPluginFreeMemoryBuffer(context, &tmp); - return 0; + return OrthancPluginErrorCode_Success; } }