feat(*): 插件中心与模型协议 - 完善声明式协议运行时并增加功能开放控制
This commit is contained in:
1 parent
7cc6021f6e
commit
919037e5d9
106 files changed
+8816
-499
No files matched your search
@@ -0,0 +1,19 @@
|
||||
package protocol
|
||||
|
||||
import "fmt"
|
||||
|
||||
type UnavailableError struct {
|
||||
Protocol string
|
||||
Reason string
|
||||
}
|
||||
|
||||
func (e UnavailableError) Error() string {
|
||||
if e.Reason == "" {
|
||||
return fmt.Sprintf("protocol %s is unavailable", e.Protocol)
|
||||
}
|
||||
return fmt.Sprintf("protocol %s is unavailable: %s", e.Protocol, e.Reason)
|
||||
}
|
||||
|
||||
func unavailable(metadata Metadata) error {
|
||||
return UnavailableError{Protocol: metadata.ID, Reason: metadata.UnavailableReason}
|
||||
}
|
||||
Reference in new issue
Block a user