Commit d735ed8f2897a9778c9ec54e9970e1f89f31ec54

Authored by Hacene SI HADJ MOHAND
1 parent 8b82976b

handling error

src/Common/DicError.cc
... ... @@ -33,6 +33,9 @@ std::string getErrorMsg(int error_code) {
33 33 return "LocalFile: Cannot find time parameter";
34 34 case AMDA_OUTOFTIME_ERR:
35 35 return "LocalFile: Out of data time";
  36 +
  37 + case AMDA_STAT_NOT_BOOL:
  38 + return "Only boolean parameters are handled by countTrue function";
36 39  
37 40 case AMDA_PARSER_TEST_ERROR:
38 41 return "Parser: At leat one error occured during test of the parser";
... ...
src/Common/DicError.hh
... ... @@ -38,6 +38,8 @@ enum {
38 38 * Parser error
39 39 */
40 40 AMDA_PARSER_TEST_ERROR = 30, /// At leat an error occured during test of the parser
  41 +
  42 + AMDA_STAT_NOT_BOOL = 40, // Unknown error
41 43  
42 44 /*------------ Errors of DD_serveur ---------------------*/
43 45 AMDA_ERROR_NOCONNECTION =201, // No connection with DD_server
... ...
src/ExternLib/StatisticProcesses/CountBoolStatistic.hh
... ... @@ -88,7 +88,7 @@ namespace AMDA {
88 88 void countTrue(Type &a) {
89 89 _dimDef.str("1");
90 90 if (typeid (a) != typeid ( AMDA::Parameters::LogicalData)) {
91   - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Only boolean params are supported supported"));
  91 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL) << AMDA::ex_msg("Only boolean params are supported supported"));
92 92 return;
93 93 }
94 94 if (isNAN(StatisticOperation<TResultData>::_resultData._result))
... ... @@ -106,7 +106,7 @@ namespace AMDA {
106 106 _dimDef << a.size();
107 107 for (unsigned int i = 0; i < a.size(); ++i) {
108 108 if (typeid (a[i]) != typeid ( AMDA::Parameters::LogicalData)) {
109   - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Only boolean params are supported supported"));
  109 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL) << AMDA::ex_msg("Only boolean params are supported supported"));
110 110 return;
111 111 }
112 112 StatisticDataScalar<int> data;
... ... @@ -165,9 +165,9 @@ namespace AMDA {
165 165 */
166 166 virtual void visit(ParamDataScalaireShort *) {
167 167 BOOST_THROW_EXCEPTION(
168   - AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN)
  168 + AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL)
169 169 << AMDA::ex_msg(
170   - "CreateStatistic operation not supported"));
  170 + "Only boolean parameters are supported"));
171 171 }
172 172  
173 173 /**
... ... @@ -175,9 +175,9 @@ namespace AMDA {
175 175 */
176 176 virtual void visit(ParamDataScalaireFloat *) {
177 177 BOOST_THROW_EXCEPTION(
178   - AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN)
  178 + AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL)
179 179 << AMDA::ex_msg(
180   - "CreateStatistic operation not supported"));
  180 + "Only boolean parameters are supported"));
181 181 }
182 182  
183 183 /**
... ... @@ -185,9 +185,9 @@ namespace AMDA {
185 185 */
186 186 virtual void visit(ParamDataScalaireDouble *) {
187 187 BOOST_THROW_EXCEPTION(
188   - AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN)
  188 + AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL)
189 189 << AMDA::ex_msg(
190   - "CreateStatistic operation not supported"));
  190 + "Only boolean parameters are supported"));
191 191 }
192 192  
193 193 /**
... ... @@ -195,9 +195,9 @@ namespace AMDA {
195 195 */
196 196 virtual void visit(ParamDataScalaireLongDouble *) {
197 197 BOOST_THROW_EXCEPTION(
198   - AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN)
  198 + AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL)
199 199 << AMDA::ex_msg(
200   - "CreateStatistic operation not supported"));
  200 + "Only boolean parameters are supported"));
201 201 }
202 202  
203 203 /**
... ... @@ -205,9 +205,9 @@ namespace AMDA {
205 205 */
206 206 virtual void visit(ParamDataScalaireInt *) {
207 207 BOOST_THROW_EXCEPTION(
208   - AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN)
  208 + AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL)
209 209 << AMDA::ex_msg(
210   - "CreateStatistic operation not supported"));
  210 + "Only boolean parameters are supported"));
211 211 }
212 212  
213 213 /**
... ... @@ -223,9 +223,9 @@ namespace AMDA {
223 223 */
224 224 virtual void visit(ParamDataTab1DShort *) {
225 225 BOOST_THROW_EXCEPTION(
226   - AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN)
  226 + AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL)
227 227 << AMDA::ex_msg(
228   - "CreateStatistic operation not supported"));
  228 + "Only boolean parameters are supported"));
229 229 }
230 230  
231 231 /**
... ... @@ -233,9 +233,9 @@ namespace AMDA {
233 233 */
234 234 virtual void visit(ParamDataTab1DFloat *) {
235 235 BOOST_THROW_EXCEPTION(
236   - AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN)
  236 + AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL)
237 237 << AMDA::ex_msg(
238   - "CreateStatistic operation not supported"));
  238 + "Only boolean parameters are supported"));
239 239 }
240 240  
241 241 /**
... ... @@ -243,9 +243,9 @@ namespace AMDA {
243 243 */
244 244 virtual void visit(ParamDataTab1DDouble *) {
245 245 BOOST_THROW_EXCEPTION(
246   - AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN)
  246 + AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL)
247 247 << AMDA::ex_msg(
248   - "CreateStatistic operation not supported"));
  248 + "Only boolean parameters are supported"));
249 249 }
250 250  
251 251 /**
... ... @@ -253,9 +253,9 @@ namespace AMDA {
253 253 */
254 254 virtual void visit(ParamDataTab1DLongDouble *) {
255 255 BOOST_THROW_EXCEPTION(
256   - AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN)
  256 + AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL)
257 257 << AMDA::ex_msg(
258   - "CreateStatistic operation not supported"));
  258 + "Only boolean parameters are supported"));
259 259 }
260 260  
261 261 /**
... ... @@ -263,9 +263,9 @@ namespace AMDA {
263 263 */
264 264 virtual void visit(ParamDataTab1DInt *) {
265 265 BOOST_THROW_EXCEPTION(
266   - AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN)
  266 + AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL)
267 267 << AMDA::ex_msg(
268   - "CreateStatistic operation not supported"));
  268 + "Only boolean parameters are supported"));
269 269 }
270 270  
271 271 /**
... ... @@ -280,42 +280,42 @@ namespace AMDA {
280 280 * @overload VisitorOfParamData::visit(ParamDataTab2DShort *)
281 281 */
282 282 virtual void visit(ParamDataTab2DShort *) {
283   - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("ParamDataTab2DShort data not supported"));
  283 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL) << AMDA::ex_msg("ParamDataTab2DShort data not supported"));
284 284 }
285 285  
286 286 /**
287 287 * @overload VisitorOfParamData::visit(ParamDataTab2DFloat *)
288 288 */
289 289 virtual void visit(ParamDataTab2DFloat *) {
290   - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("ParamDataTab2DFloat data not supported"));
  290 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL) << AMDA::ex_msg("ParamDataTab2DFloat data not supported"));
291 291 }
292 292  
293 293 /**
294 294 * @overload VisitorOfParamData::visit(ParamDataTab2DDouble *)
295 295 */
296 296 virtual void visit(ParamDataTab2DDouble *) {
297   - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("ParamDataTab2DDouble data not supported"));
  297 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL) << AMDA::ex_msg("ParamDataTab2DDouble data not supported"));
298 298 }
299 299  
300 300 /**
301 301 * @overload VisitorOfParamData::visit(ParamDataTab2DLongDouble *)
302 302 */
303 303 virtual void visit(ParamDataTab2DLongDouble *) {
304   - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("ParamDataTab2DLongDouble data not supported"));
  304 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL) << AMDA::ex_msg("ParamDataTab2DLongDouble data not supported"));
305 305 }
306 306  
307 307 /**
308 308 * @overload VisitorOfParamData::visit(ParamDataTab2DInt *)
309 309 */
310 310 virtual void visit(ParamDataTab2DInt *) {
311   - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("ParamDataTab2DInt data not supported"));
  311 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL) << AMDA::ex_msg("ParamDataTab2DInt data not supported"));
312 312 }
313 313  
314 314 /**
315 315 * @overload VisitorOfParamData::visit(ParamDataTab2DLogicalData *)
316 316 */
317 317 virtual void visit(ParamDataTab2DLogicalData *) {
318   - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("ParamDataTab2DLogicalData data not supported"));
  318 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_STAT_NOT_BOOL) << AMDA::ex_msg("ParamDataTab2DLogicalData data not supported"));
319 319 }
320 320  
321 321 private:
... ...