Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: add a panic handler for advisor check (#2853)

rebelice72bb0d60909d
diff --git a/plugin/advisor/advisor.go b/plugin/advisor/advisor.go
index 2b138f5dbc..718828f0c1 100644
--- a/plugin/advisor/advisor.go
+++ b/plugin/advisor/advisor.go
@@ -288,7 +288,13 @@ func Register(dbType db.Type, advType Type, f Advisor) {
}
// Check runs the advisor and returns the advices.
-func Check(dbType db.Type, advType Type, ctx Context, statement string) ([]Advice, error) {
+func Check(dbType db.Type, advType Type, ctx Context, statement string) (adviceList []Advice, err error) {
+ defer func() {
+ if panicErr := recover(); panicErr != nil {
+ err = errors.Errorf("panic in advisor check: %v", panicErr)
+ }
+ }()
+
advisorMu.RLock()
dbAdvisors, ok := advisors[dbType]
defer advisorMu.RUnlock()