diff --git a/errno.go b/errno.go index 11cbcaa..cbc7379 100644 --- a/errno.go +++ b/errno.go @@ -1,6 +1,10 @@ package contracts -import "github.com/samber/lo" +import ( + "errors" + + "github.com/samber/lo" +) // 定义错误码 type Errno struct { @@ -24,6 +28,8 @@ func (err Err) Error() string { return lo.Ternary(err.alert && err.Errord != "", err.Errord, err.Msg) } +var ErrFuncNotImplemented = errors.New("func not implemented") + // 错误码设计 // 第一位表示错误级别, 1 为系统错误, 2 为普通错误 // 第二三位表示服务模块代码 diff --git a/mqtt.go b/mqtt.go index d96e31d..e4f6652 100644 --- a/mqtt.go +++ b/mqtt.go @@ -57,20 +57,20 @@ type MqttHandle struct { Controller } -func (this MqttHandle) OnSubscribed(g GlobalParams, topic string) error { - return nil +func (this *MqttHandle) OnSubscribed(g GlobalParams, topic string) error { + return ErrFuncNotImplemented } func (this MqttHandle) OnUnsubscribed(g GlobalParams, topic string) error { - return nil + return ErrFuncNotImplemented } func (this MqttHandle) OnMessage(g GlobalParams, topic string, retain bool, qos byte) error { - return nil + return ErrFuncNotImplemented } func (this MqttHandle) OnMessageDropped(g GlobalParams, topic string, retain bool, qos byte) error { - return nil + return ErrFuncNotImplemented } func NewMqttController(container *do.Injector) Mqtt {