fehlerbehebung

This commit is contained in:
xoy 2023-01-29 12:55:21 +01:00
parent 1359026aaa
commit 80971c0441
2 changed files with 6 additions and 4 deletions

View File

@ -304,8 +304,11 @@ func readHttpYML() string {
} }
*/ */
func errorPanic(err error) { func errorPanic(err error, logBefore ...string) {
if err != nil { if err != nil {
for _, log := range logBefore {
logger(log)
}
logger(err.Error()) logger(err.Error())
panic("----------------ERROR----------------") panic("----------------ERROR----------------")
} }

View File

@ -52,13 +52,12 @@ func httpHandleFuncWithPOST(urlPath string, filepath string, contentType string)
errorPanic(err) errorPanic(err)
out, err := os.Create("./web/images/" + files[i].Filename) 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, "unable to create the file '"+"./web/images/"+files[i].Filename+"' for writing. Check your write access privilege")
errorPanic(err)
_, err = io.Copy(out, file) _, err = io.Copy(out, file)
errorPanic(err) errorPanic(err)
logger(files[i].Filename) logger("./web/images/" + files[i].Filename)
} }
} }
logger("date: " + date[0]) logger("date: " + date[0])