comparison Plugins/Samples/Common/OrthancPluginCppWrapper.cpp @ 3670:e64432336055 storage-commitment

integration mainline->storage-commitment
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Feb 2020 09:05:06 +0100
parents adb6d8b49283 445bda258245
children 4edeef72de75
comparison
equal deleted inserted replaced
3668:adb6d8b49283 3670:e64432336055
2170 2170
2171 std::auto_ptr<OrthancJob> protection(job); 2171 std::auto_ptr<OrthancJob> protection(job);
2172 2172
2173 if (body.type() != Json::objectValue) 2173 if (body.type() != Json::objectValue)
2174 { 2174 {
2175 #if HAS_ORTHANC_EXCEPTION == 1
2175 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, 2176 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
2176 "Expected a JSON object in the body"); 2177 "Expected a JSON object in the body");
2178 #else
2179 LogError("Expected a JSON object in the body");
2180 ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
2181 #endif
2177 } 2182 }
2178 2183
2179 bool synchronous = true; 2184 bool synchronous = true;
2180 2185
2181 if (body.isMember(KEY_SYNCHRONOUS)) 2186 if (body.isMember(KEY_SYNCHRONOUS))
2182 { 2187 {
2183 if (body[KEY_SYNCHRONOUS].type() != Json::booleanValue) 2188 if (body[KEY_SYNCHRONOUS].type() != Json::booleanValue)
2184 { 2189 {
2190 #if HAS_ORTHANC_EXCEPTION == 1
2185 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, 2191 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
2186 "Option \"" + std::string(KEY_SYNCHRONOUS) + 2192 "Option \"" + std::string(KEY_SYNCHRONOUS) +
2187 "\" must be Boolean"); 2193 "\" must be Boolean");
2194 #else
2195 LogError("Option \"" + std::string(KEY_SYNCHRONOUS) + "\" must be Boolean");
2196 ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
2197 #endif
2188 } 2198 }
2189 else 2199 else
2190 { 2200 {
2191 synchronous = body[KEY_SYNCHRONOUS].asBool(); 2201 synchronous = body[KEY_SYNCHRONOUS].asBool();
2192 } 2202 }
2194 2204
2195 if (body.isMember(KEY_ASYNCHRONOUS)) 2205 if (body.isMember(KEY_ASYNCHRONOUS))
2196 { 2206 {
2197 if (body[KEY_ASYNCHRONOUS].type() != Json::booleanValue) 2207 if (body[KEY_ASYNCHRONOUS].type() != Json::booleanValue)
2198 { 2208 {
2209 #if HAS_ORTHANC_EXCEPTION == 1
2199 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, 2210 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
2200 "Option \"" + std::string(KEY_ASYNCHRONOUS) + 2211 "Option \"" + std::string(KEY_ASYNCHRONOUS) +
2201 "\" must be Boolean"); 2212 "\" must be Boolean");
2213 #else
2214 LogError("Option \"" + std::string(KEY_ASYNCHRONOUS) + "\" must be Boolean");
2215 ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
2216 #endif
2202 } 2217 }
2203 else 2218 else
2204 { 2219 {
2205 synchronous = !body[KEY_ASYNCHRONOUS].asBool(); 2220 synchronous = !body[KEY_ASYNCHRONOUS].asBool();
2206 } 2221 }
2210 2225
2211 if (body.isMember(KEY_PRIORITY)) 2226 if (body.isMember(KEY_PRIORITY))
2212 { 2227 {
2213 if (body[KEY_PRIORITY].type() != Json::booleanValue) 2228 if (body[KEY_PRIORITY].type() != Json::booleanValue)
2214 { 2229 {
2230 #if HAS_ORTHANC_EXCEPTION == 1
2215 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, 2231 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
2216 "Option \"" + std::string(KEY_PRIORITY) + 2232 "Option \"" + std::string(KEY_PRIORITY) +
2217 "\" must be an integer"); 2233 "\" must be an integer");
2234 #else
2235 LogError("Option \"" + std::string(KEY_PRIORITY) + "\" must be an integer");
2236 ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
2237 #endif
2218 } 2238 }
2219 else 2239 else
2220 { 2240 {
2221 priority = !body[KEY_PRIORITY].asInt(); 2241 priority = !body[KEY_PRIORITY].asInt();
2222 } 2242 }