diff --git a/func.go b/func.go index f70c629..4745d5b 100644 --- a/func.go +++ b/func.go @@ -304,8 +304,11 @@ func readHttpYML() string { } */ -func errorPanic(err error) { +func errorPanic(err error, logBefore ...string) { if err != nil { + for _, log := range logBefore { + logger(log) + } logger(err.Error()) panic("----------------ERROR----------------") } diff --git a/http.go b/http.go index 7df7a8c..9c14353 100644 --- a/http.go +++ b/http.go @@ -52,13 +52,12 @@ func httpHandleFuncWithPOST(urlPath string, filepath string, contentType string) errorPanic(err) out, err := os.Create("./web/images/" + files[i].Filename) - logger("unable to create the file '" + "./web/images/" + files[i].Filename + "' for writing. Check your write access privilege") - errorPanic(err) + errorPanic(err, "unable to create the file '"+"./web/images/"+files[i].Filename+"' for writing. Check your write access privilege") _, err = io.Copy(out, file) errorPanic(err) - logger(files[i].Filename) + logger("./web/images/" + files[i].Filename) } } logger("date: " + date[0])