IVGCVSW-3987 Add armnn::Exception warning and std::exception error

Signed-off-by: Kevin May <kevin.may@arm.com>
Change-Id: I4963fb4d44501287e161f7366f38557962d06cac
diff --git a/ArmnnPreparedModel.cpp b/ArmnnPreparedModel.cpp
index 2f1abef..0899430 100644
--- a/ArmnnPreparedModel.cpp
+++ b/ArmnnPreparedModel.cpp
@@ -209,9 +209,15 @@
             pOutputTensors->emplace_back(i, outputTensor);
         }
     }
+    catch (armnn::Exception& e)
+    {
+        ALOGW("armnn::Exception caught while preparing for EnqueueWorkload: %s", e.what());
+        NotifyCallbackAndCheck(callback, ErrorStatus::GENERAL_FAILURE, "ArmnnPreparedModel::execute");
+        return ErrorStatus::GENERAL_FAILURE;
+    }
     catch (std::exception& e)
     {
-        ALOGW("Exception caught while preparing for EnqueueWorkload: %s", e.what());
+        ALOGE("std::exception caught while preparing for EnqueueWorkload: %s", e.what());
         NotifyCallbackAndCheck(callback, ErrorStatus::GENERAL_FAILURE, "ArmnnPreparedModel::execute");
         return ErrorStatus::GENERAL_FAILURE;
     }
@@ -253,9 +259,15 @@
             return;
         }
     }
+    catch (armnn::Exception& e)
+    {
+        ALOGW("armnn::Exception caught from EnqueueWorkload: %s", e.what());
+        cb.callback(ErrorStatus::GENERAL_FAILURE, "ArmnnPreparedModel::ExecuteGraph");
+        return;
+    }
     catch (std::exception& e)
     {
-        ALOGW("Exception caught from EnqueueWorkload: %s", e.what());
+        ALOGE("std::exception caught from EnqueueWorkload: %s", e.what());
         cb.callback(ErrorStatus::GENERAL_FAILURE, "ArmnnPreparedModel::ExecuteGraph");
         return;
     }
@@ -306,9 +318,14 @@
             return false;
         }
     }
+    catch (armnn::Exception& e)
+    {
+        ALOGW("ExecuteWithDummyInputs: armnn::Exception caught from EnqueueWorkload: %s", e.what());
+        return false;
+    }
     catch (std::exception& e)
     {
-        ALOGW("ExecuteWithDummyInputs: Exception caught from EnqueueWorkload: %s", e.what());
+        ALOGE("ExecuteWithDummyInputs: std::exception caught from EnqueueWorkload: %s", e.what());
         return false;
     }
     return true;
diff --git a/ArmnnPreparedModel_1_2.cpp b/ArmnnPreparedModel_1_2.cpp
index a1e481d..29aaa1e 100644
--- a/ArmnnPreparedModel_1_2.cpp
+++ b/ArmnnPreparedModel_1_2.cpp
@@ -314,12 +314,19 @@
             pOutputTensors->emplace_back(i, outputTensor);
         }
     }
-    catch (std::exception& e)
+    catch (armnn::Exception& e)
     {
-        ALOGW("Exception caught while preparing for EnqueueWorkload: %s", e.what());
+        ALOGW("armnn::Exception caught while preparing for EnqueueWorkload: %s", e.what());
         cb(ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming);
         return Void();
     }
+    catch (std::exception& e)
+    {
+        ALOGE("std::exception caught while preparing for EnqueueWorkload: %s", e.what());
+        cb(ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming);
+        return Void();
+    }
+
     ALOGV("ArmnnPreparedModel_1_2::executeSynchronously() before Execution");
 
     DumpTensorsIfRequired("Input", *pInputTensors);
@@ -345,9 +352,15 @@
             return Void();
         }
     }
+    catch (armnn::Exception& e)
+    {
+        ALOGW("armnn::Exception caught from EnqueueWorkload: %s", e.what());
+        cb(ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming);
+        return Void();
+    }
     catch (std::exception& e)
     {
-        ALOGW("Exception caught from EnqueueWorkload: %s", e.what());
+        ALOGE("std::exception caught from EnqueueWorkload: %s", e.what());
         cb(ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming);
         return Void();
     }
@@ -531,11 +544,16 @@
             return;
         }
     }
+    catch (armnn::Exception& e)
+    {
+        ALOGW("armnn:Exception caught from EnqueueWorkload: %s", e.what());
+        cb.callback(ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming, "ArmnnPreparedModel_1_2::ExecuteGraph");
+        return;
+    }
     catch (std::exception& e)
     {
-        ALOGW("Exception caught from EnqueueWorkload: %s", e.what());
-        cb.callback(ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming,
-                "ArmnnPreparedModel_1_2::ExecuteGraph");
+        ALOGE("std::exception caught from EnqueueWorkload: %s", e.what());
+        cb.callback(ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming, "ArmnnPreparedModel_1_2::ExecuteGraph");
         return;
     }
 
@@ -594,9 +612,14 @@
             return false;
         }
     }
+    catch (armnn::Exception& e)
+    {
+        ALOGW("ExecuteWithDummyInputs: armnn::Exception caught from EnqueueWorkload: %s", e.what());
+        return false;
+    }
     catch (std::exception& e)
     {
-        ALOGW("ExecuteWithDummyInputs: Exception caught from EnqueueWorkload: %s", e.what());
+        ALOGE("ExecuteWithDummyInputs: std::exception caught from EnqueueWorkload: %s", e.what());
         return false;
     }
     return true;
@@ -707,9 +730,15 @@
             }
         }
     }
+    catch (armnn::Exception& e)
+    {
+        ALOGW("armnn::Exception caught while preparing for EnqueueWorkload: %s", e.what());
+        callback(ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming, "ArmnnPreparedModel_1_2::execute");
+        return ErrorStatus::GENERAL_FAILURE;
+    }
     catch (std::exception& e)
     {
-        ALOGW("Exception caught while preparing for EnqueueWorkload: %s", e.what());
+        ALOGE("std::exception caught while preparing for EnqueueWorkload: %s", e.what());
         callback(ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming, "ArmnnPreparedModel_1_2::execute");
         return ErrorStatus::GENERAL_FAILURE;
     }