comparison OrthancServer/OrthancConfiguration.cpp @ 2955:bbfd95a0c429

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 03 Dec 2018 14:59:23 +0100
parents 2e751f615e03
children bfee0b9f3209
comparison
equal deleted inserted replaced
2954:d924f9bb61cc 2955:bbfd95a0c429
69 Json::Value tmp; 69 Json::Value tmp;
70 Json::Reader reader; 70 Json::Reader reader;
71 if (!reader.parse(content, tmp) || 71 if (!reader.parse(content, tmp) ||
72 tmp.type() != Json::objectValue) 72 tmp.type() != Json::objectValue)
73 { 73 {
74 LOG(ERROR) << "The configuration file does not follow the JSON syntax: " << path; 74 throw OrthancException(ErrorCode_BadJson,
75 throw OrthancException(ErrorCode_BadJson); 75 "The configuration file does not follow the JSON syntax: " + path.string());
76 } 76 }
77 77
78 Toolbox::CopyJsonWithoutComments(config, tmp); 78 Toolbox::CopyJsonWithoutComments(config, tmp);
79 } 79 }
80 80
88 Json::Value::Members members = config.getMemberNames(); 88 Json::Value::Members members = config.getMemberNames();
89 for (Json::Value::ArrayIndex i = 0; i < members.size(); i++) 89 for (Json::Value::ArrayIndex i = 0; i < members.size(); i++)
90 { 90 {
91 if (target.isMember(members[i])) 91 if (target.isMember(members[i]))
92 { 92 {
93 LOG(ERROR) << "The configuration section \"" << members[i] 93 throw OrthancException(ErrorCode_BadFileFormat,
94 << "\" is defined in 2 different configuration files"; 94 "The configuration section \"" + members[i] +
95 throw OrthancException(ErrorCode_BadFileFormat); 95 "\" is defined in 2 different configuration files");
96 } 96 }
97 else 97 else
98 { 98 {
99 target[members[i]] = config[members[i]]; 99 target[members[i]] = config[members[i]];
100 } 100 }