diff transform/FeatureExtractionModelTransformer.cpp @ 1080:f35c1f9bfaa2

Tighten up error handling
author Chris Cannam
date Wed, 10 Jun 2015 13:12:06 +0100
parents f4ad0bfceeb7
children 9f4505ac9072
line wrap: on
line diff
--- a/transform/FeatureExtractionModelTransformer.cpp	Wed Jun 10 13:11:45 2015 +0100
+++ b/transform/FeatureExtractionModelTransformer.cpp	Wed Jun 10 13:12:06 2015 +0100
@@ -44,7 +44,7 @@
     ModelTransformer(in, transform),
     m_plugin(0)
 {
-//    SVDEBUG << "FeatureExtractionModelTransformer::FeatureExtractionModelTransformer: plugin " << pluginId << ", outputName " << m_transform.getOutput() << endl;
+    SVDEBUG << "FeatureExtractionModelTransformer::FeatureExtractionModelTransformer: plugin " << m_transforms.begin()->getPluginIdentifier() << ", outputName " << m_transforms.begin()->getOutput() << endl;
 
     initialise();
 }
@@ -54,8 +54,12 @@
     ModelTransformer(in, transforms),
     m_plugin(0)
 {
-//    SVDEBUG << "FeatureExtractionModelTransformer::FeatureExtractionModelTransformer: plugin " << pluginId << ", outputName " << m_transform.getOutput() << endl;
-
+    if (m_transforms.empty()) {
+        SVDEBUG << "FeatureExtractionModelTransformer::FeatureExtractionModelTransformer: " << transforms.size() << " transform(s)" << endl;
+    } else {
+        SVDEBUG << "FeatureExtractionModelTransformer::FeatureExtractionModelTransformer: " << transforms.size() << " transform(s), first has plugin " << m_transforms.begin()->getPluginIdentifier() << ", outputName " << m_transforms.begin()->getOutput() << endl;
+    }
+    
     initialise();
 }
 
@@ -605,16 +609,18 @@
                                    blockSize,
                                    false,
                                    StorageAdviser::PrecisionCritical);
-            if (!model->isOK()) {
+            if (!model->isOK() || model->getError() != "") {
+                QString err = model->getError();
                 delete model;
                 for (int j = 0; j < (int)m_outputNos.size(); ++j) {
                     setCompletion(j, 100);
                 }
                 //!!! need a better way to handle this -- previously we were using a QMessageBox but that isn't an appropriate thing to do here either
-                throw AllocationFailed("Failed to create the FFT model for this feature extraction model transformer");
+                throw AllocationFailed("Failed to create the FFT model for this feature extraction model transformer: error is: " + err);
             }
             model->resume();
             fftModels.push_back(model);
+            cerr << "created model for channel " << ch << endl;
         }
     }
 
@@ -697,6 +703,7 @@
                     cerr << "FeatureExtractionModelTransformer::run: Abandoning, error is " << error << endl;
                     m_abandoned = true;
                     m_message = error;
+                    break;
                 }
             }
         } else {