diff --git a/common.go b/common.go index 9edc3b9..71cb4ca 100644 --- a/common.go +++ b/common.go @@ -1,6 +1,7 @@ package cronsun import ( + "fmt" "os" "github.com/shunfei/cronsun/conf" @@ -20,22 +21,24 @@ func Init() (err error) { // init id creator if err = initID(); err != nil { - return + return fmt.Errorf("Init UUID Generator faild: %s", err) } // init config if err = conf.Init(); err != nil { - return + return fmt.Errorf("Init Config faild: %s", err) } // init etcd client if DefalutClient, err = NewClient(conf.Config); err != nil { - return + return fmt.Errorf("Connect to ETCD %s faild: %s", + conf.Config.Etcd.Endpoints, err) } // init mongoDB if mgoDB, err = db.NewMdb(conf.Config.Mgo); err != nil { - return + return fmt.Errorf("Connect to MongoDB %s faild: %s", + conf.Config.Mgo.Hosts, err) } _Uid = os.Getuid()