Commit 9b1c46f336aa40ebc2af238214864825997d0e46

Authored by Josh Klontz
1 parent a895f0bf

more helpful missing key errors

openbr/core/eval.cpp
... ... @@ -464,11 +464,10 @@ QList<Detection> getDetections(QString key, const Template &t, bool isList, bool
464 464 dets.append(Detection(rects.at(i), confidences.at(i)));
465 465 }
466 466 } else {
467   - if (isTruth) {
  467 + if (isTruth)
468 468 dets.append(Detection(f.get<QRectF>(key)));
469   - } else {
  469 + else
470 470 dets.append(Detection(f.get<QRectF>(key), f.get<float>("Confidence", -1)));
471   - }
472 471 }
473 472 return dets;
474 473 }
... ...
openbr/openbr_plugin.h
... ... @@ -233,9 +233,9 @@ struct BR_EXPORT File
233 233 template <typename T>
234 234 T get(const QString &key) const
235 235 {
236   - if (!contains(key)) qFatal("Missing key: %s", qPrintable(key));
  236 + if (!contains(key)) qFatal("Missing key: %s in: %s", qPrintable(key), qPrintable(flat()));
237 237 QVariant variant = value(key);
238   - if (!variant.canConvert<T>()) qFatal("Can't convert: %s", qPrintable(key));
  238 + if (!variant.canConvert<T>()) qFatal("Can't convert: %s in: %s", qPrintable(key), qPrintable(flat()));
239 239 return variant.value<T>();
240 240 }
241 241  
... ... @@ -256,11 +256,11 @@ struct BR_EXPORT File
256 256 template <typename T>
257 257 QList<T> getList(const QString &key) const
258 258 {
259   - if (!contains(key)) qFatal("Missing key: %s", qPrintable(key));
  259 + if (!contains(key)) qFatal("Missing key: %s in: %s", qPrintable(key), qPrintable(flat()));
260 260 QList<T> list;
261 261 foreach (const QVariant &item, m_metadata[key].toList()) {
262 262 if (item.canConvert<T>()) list.append(item.value<T>());
263   - else qFatal("Failed to convert value for key %s.", qPrintable(key));
  263 + else qFatal("Failed to convert value for key %s in: %s", qPrintable(key), qPrintable(flat()));
264 264 }
265 265 return list;
266 266 }
... ...