Profiler::HandleException() prints to LOG().Warn() for not FAILED HRESULTs
authorAleksei Vereshchagin <avereschagin@dev.rtsoft.ru>
Mon, 11 Dec 2017 17:16:24 +0000 (20:16 +0300)
committerAleksei Vereshchagin <avereschagin@dev.rtsoft.ru>
Mon, 11 Dec 2017 17:16:24 +0000 (20:16 +0300)
src/profiler.cpp

index efbe8b902282a14cfdff5a81bee9a471ea227d68..262e1c2091ad54d894f8bb312776e02a2af791d5 100644 (file)
@@ -187,8 +187,16 @@ HRESULT Profiler::HandleException(const std::exception &e) const noexcept
     {
         if (pHresultException)
         {
-            LOG().Error() << "Exception: " << pHresultException->what()
-                << " (HR = " << pHresultException->hresult() << ")";
+            if (FAILED(pHresultException->hresult()))
+            {
+                LOG().Error() << "Exception: " << pHresultException->what()
+                    << " (HR = " << pHresultException->hresult() << ")";
+            }
+            else
+            {
+                LOG().Warn() << "Exception: " << pHresultException->what()
+                    << " (HR = " << pHresultException->hresult() << ")";
+            }
         }
         else if (p_system_error)
         {