Bladeren bron

fix(grpc_BS):fix yaml load exception processing

孙嘉城 4 jaren geleden
bovenliggende
commit
9c6c01fef9
1 gewijzigde bestanden met toevoegingen van 9 en 2 verwijderingen
  1. 9 2
      src/driver/driver_cloud_grpc_client_BS/main.cpp

+ 9 - 2
src/driver/driver_cloud_grpc_client_BS/main.cpp

@@ -30,9 +30,16 @@ void dec_yaml(const char * stryamlpath)
     {
     {
         config = YAML::LoadFile(stryamlpath);
         config = YAML::LoadFile(stryamlpath);
     }
     }
-    catch(...)
+    catch(YAML::BadFile &e)
     {
     {
-        qDebug("yaml file has some unknown characters or load fail.");
+        std::cout<<e.what()<<std::endl;
+        qDebug("yaml file load fail.");
+        return;
+    }
+    catch(YAML::ParserException &e)
+    {
+        std::cout<<e.what()<<std::endl;
+        qDebug("yaml file is malformed.");
         return;
         return;
     }
     }