Catch process exception

This commit is contained in:
John Zhao 2018-06-12 23:08:28 +08:00
parent 24ca757c92
commit a119b36f72

View File

@ -15,8 +15,10 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <exception>
#include <utility> #include <utility>
#include "internal/strings.h"
#include "internal/times.h" #include "internal/times.h"
MYNTEYE_BEGIN_NAMESPACE MYNTEYE_BEGIN_NAMESPACE
@ -192,14 +194,21 @@ void Processor::Run() {
pre_callback_(input_.get()); pre_callback_(input_.get());
} }
bool ok = false; bool ok = false;
if (callback_) { try {
if (callback_(input_.get(), output_.get(), parent_)) { if (callback_) {
ok = true; if (callback_(input_.get(), output_.get(), parent_)) {
ok = true;
} else {
ok = OnProcess(input_.get(), output_.get(), parent_);
}
} else { } else {
ok = OnProcess(input_.get(), output_.get(), parent_); ok = OnProcess(input_.get(), output_.get(), parent_);
} }
} else { // CV_Assert(false);
ok = OnProcess(input_.get(), output_.get(), parent_); } catch (const std::exception &e) {
std::string msg(e.what());
strings::rtrim(msg);
LOG(ERROR) << Name() << " process error \"" << msg << "\"";
} }
if (!ok) { if (!ok) {
VLOG(2) << Name() << " process failed"; VLOG(2) << Name() << " process failed";