# HG changeset patch # User Sebastien Jodogne # Date 1581667480 -3600 # Node ID 445bda258245777cf4c9574b8013b557e056c126 # Parent c8d8c3b5f47cff18ae55b0e5aa741e783fd5b39a fix diff -r c8d8c3b5f47c -r 445bda258245 Plugins/Samples/Common/OrthancPluginCppWrapper.cpp --- a/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Thu Feb 13 18:05:51 2020 +0100 +++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Fri Feb 14 09:04:40 2020 +0100 @@ -2172,8 +2172,13 @@ if (body.type() != Json::objectValue) { +#if HAS_ORTHANC_EXCEPTION == 1 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "Expected a JSON object in the body"); +#else + LogError("Expected a JSON object in the body"); + ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat); +#endif } bool synchronous = true; @@ -2182,9 +2187,14 @@ { if (body[KEY_SYNCHRONOUS].type() != Json::booleanValue) { +#if HAS_ORTHANC_EXCEPTION == 1 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "Option \"" + std::string(KEY_SYNCHRONOUS) + "\" must be Boolean"); +#else + LogError("Option \"" + std::string(KEY_SYNCHRONOUS) + "\" must be Boolean"); + ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat); +#endif } else { @@ -2196,9 +2206,14 @@ { if (body[KEY_ASYNCHRONOUS].type() != Json::booleanValue) { +#if HAS_ORTHANC_EXCEPTION == 1 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "Option \"" + std::string(KEY_ASYNCHRONOUS) + "\" must be Boolean"); +#else + LogError("Option \"" + std::string(KEY_ASYNCHRONOUS) + "\" must be Boolean"); + ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat); +#endif } else { @@ -2212,9 +2227,14 @@ { if (body[KEY_PRIORITY].type() != Json::booleanValue) { +#if HAS_ORTHANC_EXCEPTION == 1 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "Option \"" + std::string(KEY_PRIORITY) + "\" must be an integer"); +#else + LogError("Option \"" + std::string(KEY_PRIORITY) + "\" must be an integer"); + ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat); +#endif } else {