comparison OrthancServer/OrthancInitialization.cpp @ 2955:bbfd95a0c429

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 03 Dec 2018 14:59:23 +0100
parents 4767d36679ed
children 517fc4767ae0 4e43e67f8ecf
comparison
equal deleted inserted replaced
2954:d924f9bb61cc 2955:bbfd95a0c429
65 { 65 {
66 const std::string& name = members[i]; 66 const std::string& name = members[i];
67 67
68 if (!parameter[name].isInt()) 68 if (!parameter[name].isInt())
69 { 69 {
70 LOG(ERROR) << "Not a number in this user-defined metadata: " << name; 70 throw OrthancException(ErrorCode_BadParameterType,
71 throw OrthancException(ErrorCode_BadParameterType); 71 "Not a number in this user-defined metadata: " + name);
72 } 72 }
73 73
74 int metadata = parameter[name].asInt(); 74 int metadata = parameter[name].asInt();
75 75
76 LOG(INFO) << "Registering user-defined metadata: " << name << " (index " 76 LOG(INFO) << "Registering user-defined metadata: " << name << " (index "
117 { 117 {
118 contentType = value.asInt(); 118 contentType = value.asInt();
119 } 119 }
120 else 120 else
121 { 121 {
122 LOG(ERROR) << "Not a number in this user-defined attachment type: " << name; 122 throw OrthancException(ErrorCode_BadParameterType,
123 throw OrthancException(ErrorCode_BadParameterType); 123 "Not a number in this user-defined attachment type: " + name);
124 } 124 }
125 125
126 LOG(INFO) << "Registering user-defined attachment type: " << name << " (index " 126 LOG(INFO) << "Registering user-defined attachment type: " << name << " (index "
127 << contentType << ") with MIME type \"" << mime << "\""; 127 << contentType << ") with MIME type \"" << mime << "\"";
128 128
181 { 181 {
182 if (config.type() != Json::objectValue || 182 if (config.type() != Json::objectValue ||
183 !config.isMember("Module") || 183 !config.isMember("Module") ||
184 config["Module"].type() != Json::stringValue) 184 config["Module"].type() != Json::stringValue)
185 { 185 {
186 LOG(ERROR) << "No path to the PKCS#11 module (DLL or .so) is provided for HTTPS client authentication"; 186 throw OrthancException(ErrorCode_BadFileFormat,
187 throw OrthancException(ErrorCode_BadFileFormat); 187 "No path to the PKCS#11 module (DLL or .so) is provided "
188 "for HTTPS client authentication");
188 } 189 }
189 190
190 std::string pin; 191 std::string pin;
191 if (config.isMember("Pin")) 192 if (config.isMember("Pin"))
192 { 193 {
194 { 195 {
195 pin = config["Pin"].asString(); 196 pin = config["Pin"].asString();
196 } 197 }
197 else 198 else
198 { 199 {
199 LOG(ERROR) << "The PIN number in the PKCS#11 configuration must be a string"; 200 throw OrthancException(ErrorCode_BadFileFormat,
200 throw OrthancException(ErrorCode_BadFileFormat); 201 "The PIN number in the PKCS#11 configuration must be a string");
201 } 202 }
202 } 203 }
203 204
204 bool verbose = false; 205 bool verbose = false;
205 if (config.isMember("Verbose")) 206 if (config.isMember("Verbose"))
208 { 209 {
209 verbose = config["Verbose"].asBool(); 210 verbose = config["Verbose"].asBool();
210 } 211 }
211 else 212 else
212 { 213 {
213 LOG(ERROR) << "The Verbose option in the PKCS#11 configuration must be a Boolean"; 214 throw OrthancException(ErrorCode_BadFileFormat,
214 throw OrthancException(ErrorCode_BadFileFormat); 215 "The Verbose option in the PKCS#11 configuration must be a Boolean");
215 } 216 }
216 } 217 }
217 218
218 HttpClient::InitializePkcs11(config["Module"].asString(), pin, verbose); 219 HttpClient::InitializePkcs11(config["Module"].asString(), pin, verbose);
219 } 220 }