New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] err not returned in Func LoadPolicyArray #1083
Comments
@JalinWang plz work on it /cc @tangyang9464 |
why not allow empty |
@GerryLon Which adapter? |
github.com/casbin/mongodb-adapter/v3 v3.3.0 "github.com/casbin/casbin/v2/persist"
mongodbadapter "github.com/casbin/mongodb-adapter/v3" |
my main codes like below: package auth
import (
"github.com/casbin/casbin/v2"
mongodbadapter "github.com/casbin/mongodb-adapter/v3"
)
func InitCasbin() {
// 定义基于mongodb的casbin适配器
adapter, err = mongodbadapter.NewAdapterWithClientOption(mongoClientOption, databaseName)
if err != nil {
log.ErrorContext(ctx, err)
return nil, err
}
casbinModel, err = casbinmodel.NewModelFromString(mconf)
if err != nil {
log.ErrorContext(ctx, err)
return nil, err
}
enforcer, err = casbin.NewSyncedEnforcer(casbinModel, adapter)
if err != nil {
log.ErrorContext(ctx, err)
return nil, err
}
// load policy from db or file into memory
if err = enforcer.LoadPolicy(); err != nil {
log.ErrorContext(ctx, err)
return nil, err
}
} when I debug above codes, in |
@GerryLon are you reporting a new issue other than this one? If yes, plz create a new issue here: https://github.com/casbin/mongodb-adapter/issues |
@hsluoyz All the adapters depend on this function without error handling. Should we modify them all? |
We can add error as return value, but the adapters don't need to be modified to handle the return value |
Casbin version: v2.52.2
Bug: err not returned in Func LoadPolicyArray
The text was updated successfully, but these errors were encountered: