Procházet zdrojové kódy

bug(function): should return error when load plugin fails

ngjaying před 5 roky
rodič
revize
c793ec0c70
2 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 1 0
      common/plugin_manager/manager.go
  2. 1 1
      xsql/functions.go

+ 1 - 0
common/plugin_manager/manager.go

@@ -33,6 +33,7 @@ func GetPlugin(t string, ptype string) (plugin.Symbol, error) {
 		if err != nil {
 			return nil, fmt.Errorf("cannot find symbol %s, please check if it is exported", t)
 		}
+		registry[key] = nf
 	}
 	return nf, nil
 }

+ 1 - 1
xsql/functions.go

@@ -77,7 +77,7 @@ func (*FunctionValuer) Call(name string, args []interface{}) (interface{}, bool)
 	} else {
 		common.Log.Debugf("run func %s", name)
 		if nf, err := plugin_manager.GetPlugin(name, "functions"); err != nil {
-			return nil, false
+			return err, false
 		} else {
 			f, ok := nf.(api.Function)
 			if !ok {