fix: fix issue with skipping prepared statements for some roles on error
This commit is contained in:
parent
279f5616d1
commit
842252f9e2
|
@ -122,7 +122,7 @@ func (sg *SuperGraph) prepareStmt(item allow.Item) error {
|
||||||
|
|
||||||
stmts, err := sg.buildRoleStmt(qb, vars, role.Name)
|
stmts, err := sg.buildRoleStmt(qb, vars, role.Name)
|
||||||
if err == psql.ErrAllTablesSkipped {
|
if err == psql.ErrAllTablesSkipped {
|
||||||
return nil
|
continue
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -92,10 +92,6 @@ func apiV1(w http.ResponseWriter, r *http.Request) {
|
||||||
//nolint: errcheck
|
//nolint: errcheck
|
||||||
json.NewEncoder(w).Encode(res)
|
json.NewEncoder(w).Encode(res)
|
||||||
|
|
||||||
} else {
|
|
||||||
renderErr(w, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if doLog && logLevel >= LogLevelInfo {
|
if doLog && logLevel >= LogLevelInfo {
|
||||||
zlog.Info("success",
|
zlog.Info("success",
|
||||||
zap.String("op", res.OperationName()),
|
zap.String("op", res.OperationName()),
|
||||||
|
@ -103,6 +99,21 @@ func apiV1(w http.ResponseWriter, r *http.Request) {
|
||||||
zap.String("role", res.Role()),
|
zap.String("role", res.Role()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
renderErr(w, err)
|
||||||
|
|
||||||
|
if doLog && logLevel >= LogLevelInfo {
|
||||||
|
zlog.Error("error",
|
||||||
|
zap.String("op", res.OperationName()),
|
||||||
|
zap.String("name", res.QueryName()),
|
||||||
|
zap.String("role", res.Role()),
|
||||||
|
zap.Error(err),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint: errcheck
|
//nolint: errcheck
|
||||||
|
|
Loading…
Reference in New Issue