Explorar el Código

添加初始化校验

wangbo hace 7 meses
padre
commit
cd783e6012
Se han modificado 1 ficheros con 12 adiciones y 0 borrados
  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