瀏覽代碼

fix(grpc_BS):fix yaml load exception processing

孙嘉城 4 年之前
父節點
當前提交
9c6c01fef9
共有 1 個文件被更改,包括 9 次插入2 次删除
  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);
     }
-    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;
     }