|
@@ -1,6 +1,7 @@
|
|
package helper
|
|
package helper
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "errors"
|
|
"strings"
|
|
"strings"
|
|
|
|
|
|
"github.com/langgenius/dify-plugin-daemon/internal/db"
|
|
"github.com/langgenius/dify-plugin-daemon/internal/db"
|
|
@@ -9,6 +10,10 @@ import (
|
|
"github.com/langgenius/dify-plugin-daemon/internal/utils/cache"
|
|
"github.com/langgenius/dify-plugin-daemon/internal/utils/cache"
|
|
)
|
|
)
|
|
|
|
|
|
|
|
+var (
|
|
|
|
+ ErrPluginNotFound = errors.New("plugin not found")
|
|
|
|
+)
|
|
|
|
+
|
|
func CombinedGetPluginDeclaration(
|
|
func CombinedGetPluginDeclaration(
|
|
plugin_unique_identifier plugin_entities.PluginUniqueIdentifier,
|
|
plugin_unique_identifier plugin_entities.PluginUniqueIdentifier,
|
|
tenant_id string,
|
|
tenant_id string,
|
|
@@ -27,8 +32,8 @@ func CombinedGetPluginDeclaration(
|
|
declaration, err := db.GetOne[models.PluginDeclaration](
|
|
declaration, err := db.GetOne[models.PluginDeclaration](
|
|
db.Equal("plugin_unique_identifier", plugin_unique_identifier.String()),
|
|
db.Equal("plugin_unique_identifier", plugin_unique_identifier.String()),
|
|
)
|
|
)
|
|
- if err != nil && err != db.ErrDatabaseNotFound {
|
|
|
|
- return nil, err
|
|
|
|
|
|
+ if err == db.ErrDatabaseNotFound {
|
|
|
|
+ return nil, ErrPluginNotFound
|
|
}
|
|
}
|
|
|
|
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -42,8 +47,8 @@ func CombinedGetPluginDeclaration(
|
|
db.Equal("plugin_unique_identifier", plugin_unique_identifier.String()),
|
|
db.Equal("plugin_unique_identifier", plugin_unique_identifier.String()),
|
|
db.Equal("install_type", string(plugin_entities.PLUGIN_RUNTIME_TYPE_REMOTE)),
|
|
db.Equal("install_type", string(plugin_entities.PLUGIN_RUNTIME_TYPE_REMOTE)),
|
|
)
|
|
)
|
|
- if err != nil && err != db.ErrDatabaseNotFound {
|
|
|
|
- return nil, err
|
|
|
|
|
|
+ if err == db.ErrDatabaseNotFound {
|
|
|
|
+ return nil, ErrPluginNotFound
|
|
}
|
|
}
|
|
|
|
|
|
if err != nil {
|
|
if err != nil {
|