From 8e0aa365c0b70b46671f09cf8e78d90cffcf2efa Mon Sep 17 00:00:00 2001 From: xoy Date: Sun, 29 Jan 2023 12:55:21 +0100 Subject: [PATCH] fehlerbehebung --- func.go | 5 ++++- http.go | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) 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])