loadone catch error

This commit is contained in:
mr
2026-03-04 12:40:06 +01:00
parent 3e0f369850
commit ae7e297622

View File

@@ -133,7 +133,10 @@ func GenericLoadOne[T DBObject](id string, data T, f func(DBObject) (DBObject, i
return nil, code, err
}
fmt.Println("APPLY", data, res_mongo)
res_mongo.Decode(&data)
if err = res_mongo.Decode(&data); err == nil {
return nil, 400, err
}
if a.ShouldVerifyAuth() && !data.VerifyAuth("get", a.GetRequest()) {
return nil, 403, errors.New("you are not allowed to access :" + a.GetType().String())
}