--- /dev/null
+package errormsg\r
+\r
+import (\r
+ "errors"\r
+ "strconv"\r
+)\r
+\r
+type OrchestrationError int\r
+\r
+const (\r
+ ErrorNotReadyOrchestrationInit = ((1 + iota) ^ -1) + 1\r
+ ErrorTurnOffWifi\r
+ ErrorDisconnectWifi\r
+)\r
+\r
+var orchestrationErrorString = [...]string{\r
+ "",\r
+ "ErrorNotReadyOrchestrationInit : \" Please wait until Orchestration init function has been completed \" ",\r
+ "ErrorTurnOffWifi : \" Please Turn On Wifi \" ",\r
+ "ErrorDisconnectWifi : \" Please Connect Wifi \" ",\r
+}\r
+\r
+func ToString(args interface{}) string {\r
+\r
+ switch args.(type) {\r
+ case int:\r
+ v := args.(int)\r
+ return orchestrationErrorString[v*-1]\r
+ case error:\r
+ err := args.(error)\r
+ v, _ := strconv.Atoi(err.Error())\r
+ return orchestrationErrorString[v*-1]\r
+ }\r
+\r
+ return "NOT SUPPORT TYPE"\r
+}\r
+\r
+func ToError(orcheError int) error {\r
+ return errors.New(strconv.Itoa(orcheError))\r
+}\r
+\r
+func ToInt(err error) int {\r
+ v, _ := strconv.Atoi(err.Error())\r
+ return v\r
+}\r
--- /dev/null
+package errormsg\r
+\r
+import \r
+(\r
+ "testing"\r
+)\r
+\r
+func TestErrorMsg(t *testing.T) {\r
+ err := ToError(ErrorNotReadyOrchestrationInit)\r
+ t.Log(ToString(err))\r
+}
\ No newline at end of file