Mercurial > hg > orthanc
comparison Plugins/Engine/PluginsJob.cpp @ 2956:bfee0b9f3209
cont
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 03 Dec 2018 15:11:42 +0100 |
parents | 925d8dc03a23 |
children | 4e43e67f8ecf |
comparison
equal
deleted
inserted
replaced
2955:bbfd95a0c429 | 2956:bfee0b9f3209 |
---|---|
146 Json::Reader reader; | 146 Json::Reader reader; |
147 | 147 |
148 if (!reader.parse(content, value) || | 148 if (!reader.parse(content, value) || |
149 value.type() != Json::objectValue) | 149 value.type() != Json::objectValue) |
150 { | 150 { |
151 LOG(ERROR) << "A job plugin must provide a JSON object as its public content"; | 151 throw OrthancException(ErrorCode_Plugin, |
152 throw OrthancException(ErrorCode_Plugin); | 152 "A job plugin must provide a JSON object as its public content"); |
153 } | 153 } |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 bool PluginsJob::Serialize(Json::Value& value) | 157 bool PluginsJob::Serialize(Json::Value& value) |
167 Json::Reader reader; | 167 Json::Reader reader; |
168 | 168 |
169 if (!reader.parse(serialized, value) || | 169 if (!reader.parse(serialized, value) || |
170 value.type() != Json::objectValue) | 170 value.type() != Json::objectValue) |
171 { | 171 { |
172 LOG(ERROR) << "A job plugin must provide a JSON object as its serialized content"; | 172 throw OrthancException(ErrorCode_Plugin, |
173 throw OrthancException(ErrorCode_Plugin); | 173 "A job plugin must provide a JSON object as its serialized content"); |
174 } | 174 } |
175 | 175 |
176 | 176 |
177 static const char* KEY_TYPE = "Type"; | 177 static const char* KEY_TYPE = "Type"; |
178 | 178 |
179 if (value.isMember(KEY_TYPE)) | 179 if (value.isMember(KEY_TYPE)) |
180 { | 180 { |
181 LOG(ERROR) << "The \"Type\" field is for reserved use for serialized job"; | 181 throw OrthancException(ErrorCode_Plugin, |
182 throw OrthancException(ErrorCode_Plugin); | 182 "The \"Type\" field is for reserved use for serialized job"); |
183 } | 183 } |
184 | 184 |
185 value[KEY_TYPE] = type_; | 185 value[KEY_TYPE] = type_; |
186 return true; | 186 return true; |
187 } | 187 } |