@@ -27,8 +27,8 @@ func isTargetRepo(siteName string) bool {
2727 return strings .HasPrefix (siteName , "cc_" ) || strings .Count (siteName , "_" ) == 2
2828}
2929
30- func wrapRepoError (function string , err error ) (int , error ) {
31- return 0 , fmt .Errorf ("%s(): %s " , function , err .Error ())
30+ func wrapRepoError (function string , path string , err error ) (int , error ) {
31+ return 0 , fmt .Errorf ("%s(): path = %s, %s " , function , path , err .Error ())
3232}
3333
3434func CreateRepo (siteName string , needStart bool , diff string , providerName string ) (int , error ) {
@@ -38,14 +38,14 @@ func CreateRepo(siteName string, needStart bool, diff string, providerName strin
3838 repoUrl := getRepoUrl (originalName )
3939 err := gitClone (repoUrl , path )
4040 if err != nil {
41- return wrapRepoError ("gitClone" , err )
41+ return wrapRepoError ("gitClone" , path , err )
4242 }
4343
4444 language := beego .AppConfig .String ("language" )
4545 if language == "en" {
4646 _ , err = gitCreateDatabase (siteName )
4747 if err != nil {
48- return wrapRepoError ("gitCreateDatabase" , err )
48+ return wrapRepoError ("gitCreateDatabase" , path , err )
4949 }
5050 }
5151
@@ -62,38 +62,38 @@ func CreateRepo(siteName string, needStart bool, diff string, providerName strin
6262 if diff != "" {
6363 err = gitApply (path , diff )
6464 if err != nil {
65- return wrapRepoError ("gitApply" , err )
65+ return wrapRepoError ("gitApply" , path , err )
6666 }
6767 }
6868 }
6969
7070 if needWebBuild {
7171 err = gitWebBuild (path )
7272 if err != nil {
73- return wrapRepoError ("gitWebBuild" , err )
73+ return wrapRepoError ("gitWebBuild" , path , err )
7474 }
7575
7676 err = gitUploadCdn (providerName , siteName )
7777 if err != nil {
78- return wrapRepoError ("gitUploadCdn" , err )
78+ return wrapRepoError ("gitUploadCdn" , path , err )
7979 }
8080 }
8181
8282 batExisted , err := updateBatFile (siteName )
8383 if err != nil {
84- return wrapRepoError ("updateBatFile" , err )
84+ return wrapRepoError ("updateBatFile" , path , err )
8585 }
8686
8787 if ! batExisted {
8888 err = updateShortcutFile (siteName )
8989 if err != nil {
90- return wrapRepoError ("updateShortcutFile" , err )
90+ return wrapRepoError ("updateShortcutFile" , path , err )
9191 }
9292 }
9393 } else {
9494 affected , err := gitPull (path )
9595 if err != nil {
96- return wrapRepoError ("gitPull" , err )
96+ return wrapRepoError ("gitPull" , path , err )
9797 }
9898
9999 needWebBuild := false
@@ -123,24 +123,24 @@ func CreateRepo(siteName string, needStart bool, diff string, providerName strin
123123 if needWebBuild {
124124 err = gitWebBuild (path )
125125 if err != nil {
126- return wrapRepoError ("gitWebBuild" , err )
126+ return wrapRepoError ("gitWebBuild" , path , err )
127127 }
128128
129129 err = gitUploadCdn (providerName , siteName )
130130 if err != nil {
131- return wrapRepoError ("gitUploadCdn" , err )
131+ return wrapRepoError ("gitUploadCdn" , path , err )
132132 }
133133 }
134134
135135 batExisted , err := updateBatFile (siteName )
136136 if err != nil {
137- return wrapRepoError ("updateBatFile" , err )
137+ return wrapRepoError ("updateBatFile" , path , err )
138138 }
139139
140140 if ! batExisted {
141141 err = updateShortcutFile (siteName )
142142 if err != nil {
143- return wrapRepoError ("updateShortcutFile" , err )
143+ return wrapRepoError ("updateShortcutFile" , path , err )
144144 }
145145 }
146146
@@ -149,19 +149,19 @@ func CreateRepo(siteName string, needStart bool, diff string, providerName strin
149149 if ! strings .HasPrefix (siteName , "casdoor" ) && ! strings .HasPrefix (siteName , "casibase" ) {
150150 err = stopProcess (siteName )
151151 if err != nil {
152- return wrapRepoError ("stopProcess" , err )
152+ return wrapRepoError ("stopProcess" , path , err )
153153 }
154154 }
155155
156156 err = startProcess (siteName )
157157 if err != nil {
158- return wrapRepoError ("startProcess" , err )
158+ return wrapRepoError ("startProcess" , path , err )
159159 }
160160
161161 var pid int
162162 pid , err = getPid (siteName )
163163 if err != nil {
164- return wrapRepoError ("getPid" , err )
164+ return wrapRepoError ("getPid" , path , err )
165165 }
166166
167167 return pid , nil
@@ -172,12 +172,12 @@ func CreateRepo(siteName string, needStart bool, diff string, providerName strin
172172 if needStart {
173173 err := startProcess (siteName )
174174 if err != nil {
175- return wrapRepoError ("startProcess" , err )
175+ return wrapRepoError ("startProcess" , path , err )
176176 }
177177
178178 pid , err := getPid (siteName )
179179 if err != nil {
180- return wrapRepoError ("getPid" , err )
180+ return wrapRepoError ("getPid" , path , err )
181181 }
182182
183183 return pid , nil
0 commit comments