fix model retrain not working closes #93

This commit is contained in:
2024-04-16 16:02:57 +01:00
parent 026932cfab
commit f182b205f8
7 changed files with 144 additions and 179 deletions

View File

@@ -9,6 +9,7 @@ import (
"net/http"
"os"
"path"
"runtime/debug"
"strings"
"time"
@@ -57,7 +58,7 @@ func handleError(err *Error, c *Context) {
e = c.SendJSON(500)
}
if e != nil {
c.Logger.Error("Something went very wrong while trying to send and error message")
c.Logger.Error("Something went very wrong while trying to send and error message", "stack", string(debug.Stack()))
c.Writer.Write([]byte("505"))
}
}
@@ -195,7 +196,7 @@ func DeleteAuthJson[T interface{}](x *Handle, path string, authLevel dbtypes.Use
func handleLoop(array []HandleFunc, context *Context) {
defer func() {
if r := recover(); r != nil {
context.Logger.Error("Something went very wrong", "Error", r)
context.Logger.Error("Something went very wrong", "Error", r, "stack", string(debug.Stack()))
handleError(&Error{500, "500"}, context)
}
}()
@@ -418,8 +419,7 @@ func (c Context) ErrorCode(err error, code int, data any) *Error {
c.SetReportCaller(false)
}
if err != nil {
c.Logger.Errorf("Something went wrong returning with: %d\n.Err:\n", code)
c.Logger.Error(err)
c.Logger.Error("Something went wrong returning with:", "Error", err)
}
return &Error{code, data}
}