docs: fix Send migration guide — restore old error-only signature in before/after example
This commit is contained in:
parent
b811d8cd42
commit
ae96f11821
2 changed files with 6 additions and 6 deletions
|
|
@ -253,10 +253,10 @@ func (c *TelegramChannel) Stop(ctx context.Context) error {
|
|||
|
||||
```go
|
||||
// Old code: returned only error
|
||||
func (c *TelegramChannel) Send(ctx context.Context, msg bus.OutboundMessage) ([]string, error) {
|
||||
if !c.running { return nil, fmt.Errorf("not running") }
|
||||
func (c *TelegramChannel) Send(ctx context.Context, msg bus.OutboundMessage) error {
|
||||
if !c.running { return fmt.Errorf("not running") }
|
||||
// ...
|
||||
if err != nil { return nil, err }
|
||||
if err != nil { return err }
|
||||
}
|
||||
|
||||
// New code: return delivered message IDs plus sentinel errors
|
||||
|
|
|
|||
|
|
@ -253,10 +253,10 @@ func (c *TelegramChannel) Stop(ctx context.Context) error {
|
|||
|
||||
```go
|
||||
// 旧代码:只返回 error
|
||||
func (c *TelegramChannel) Send(ctx context.Context, msg bus.OutboundMessage) ([]string, error) {
|
||||
if !c.running { return nil, fmt.Errorf("not running") }
|
||||
func (c *TelegramChannel) Send(ctx context.Context, msg bus.OutboundMessage) error {
|
||||
if !c.running { return fmt.Errorf("not running") }
|
||||
// ...
|
||||
if err != nil { return nil, err }
|
||||
if err != nil { return err }
|
||||
}
|
||||
|
||||
// 新代码:返回投递后的消息 ID,以及供 Manager 判断重试策略的哨兵错误
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue