loadone catch error
This commit is contained in:
@@ -133,7 +133,10 @@ func GenericLoadOne[T DBObject](id string, data T, f func(DBObject) (DBObject, i
|
|||||||
return nil, code, err
|
return nil, code, err
|
||||||
}
|
}
|
||||||
fmt.Println("APPLY", data, res_mongo)
|
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()) {
|
if a.ShouldVerifyAuth() && !data.VerifyAuth("get", a.GetRequest()) {
|
||||||
return nil, 403, errors.New("you are not allowed to access :" + a.GetType().String())
|
return nil, 403, errors.New("you are not allowed to access :" + a.GetType().String())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user