]> sigrok.org Git - pulseview.git/commitdiff
MathSignal: Use error message
authorSoeren Apel <redacted>
Thu, 13 Aug 2020 16:27:20 +0000 (18:27 +0200)
committerSoeren Apel <redacted>
Sat, 22 Aug 2020 22:16:19 +0000 (00:16 +0200)
pv/data/mathsignal.cpp

index 25b8110e07a78c2a9e5cbbea5957ed1ee29a0b6b..97e312bce2af63dca68d77c41d1e7062c75f7076 100644 (file)
@@ -117,7 +117,7 @@ void MathSignal::set_error_message(QString msg)
 {
        error_message_ = msg;
        // TODO Emulate noquote()
-       qDebug().nospace() << name() << ": " << msg;
+       qDebug().nospace() << name() << ": " << msg << "(Expression: '" << expression_ << "')";
 }
 
 uint64_t MathSignal::get_working_sample_count(uint32_t segment_id) const
@@ -198,10 +198,12 @@ void MathSignal::begin_generation()
        exprtk_expression_->register_symbol_table(*exprtk_symbol_table_);
 
        exprtk_parser_ = new exprtk::parser<double>();
-       exprtk_parser_->compile(expression_.toStdString(), *exprtk_expression_);
-
-       gen_interrupt_ = false;
-       gen_thread_ = std::thread(&MathSignal::generation_proc, this);
+       if (!exprtk_parser_->compile(expression_.toStdString(), *exprtk_expression_)) {
+               error_message_ = set_error_message(tr("Error in expression"));
+       } else {
+               gen_interrupt_ = false;
+               gen_thread_ = std::thread(&MathSignal::generation_proc, this);
+       }
 }
 
 void MathSignal::generate_samples(uint32_t segment_id, const uint64_t start_sample,