Procházet zdrojové kódy

添加初始化校验

wangbo před 7 měsíci
rodič
revize
cd783e6012
1 změnil soubory, kde provedl 12 přidání a 0 odebrání
  1. 12 0
      osm_sdk.go

+ 12 - 0
osm_sdk.go

@@ -34,6 +34,18 @@ func Init(configPrefix string, configNamespace string, configName string, config
 		timeoutDuration = duration
 	}
 
+	if strutils.IsStringEmpty(namespace) {
+		return errors.New("namespace is empty")
+	}
+
+	if strutils.IsStringEmpty(name) {
+		return errors.New("name is empty")
+	}
+
+	if strutils.IsStringEmpty(baseUrl) {
+		return errors.New("baseUrl is empty")
+	}
+
 	prefix = configPrefix
 	namespace = configNamespace
 	name = configName