Merge pull request #3189 from chengzhichao-xydt/codex/line-body-close
fix(line): explicitly ignore resp.Body.Close() errors in Send and classifySDKError
This commit is contained in:
commit
b6e6d25d75
1 changed files with 4 additions and 3 deletions
|
|
@ -69,7 +69,8 @@ func NewLINEChannel(
|
||||||
return nil, fmt.Errorf("failed to create LINE messaging client: %w", err)
|
return nil, fmt.Errorf("failed to create LINE messaging client: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
base := channels.NewBaseChannel("line", cfg, messageBus, bc.AllowFrom,
|
base := channels.NewBaseChannel(
|
||||||
|
"line", cfg, messageBus, bc.AllowFrom,
|
||||||
channels.WithMaxMessageLength(5000),
|
channels.WithMaxMessageLength(5000),
|
||||||
channels.WithGroupTrigger(bc.GroupTrigger),
|
channels.WithGroupTrigger(bc.GroupTrigger),
|
||||||
channels.WithReasoningChannelID(bc.ReasoningChannelID),
|
channels.WithReasoningChannelID(bc.ReasoningChannelID),
|
||||||
|
|
@ -482,7 +483,7 @@ func (c *LINEChannel) Send(ctx context.Context, msg bus.OutboundMessage) ([]stri
|
||||||
Messages: []messaging_api.MessageInterface{&textMsg},
|
Messages: []messaging_api.MessageInterface{&textMsg},
|
||||||
})
|
})
|
||||||
if resp != nil && resp.Body != nil {
|
if resp != nil && resp.Body != nil {
|
||||||
resp.Body.Close()
|
_ = resp.Body.Close()
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
logger.DebugCF("line", "Message sent via Reply API", map[string]any{
|
logger.DebugCF("line", "Message sent via Reply API", map[string]any{
|
||||||
|
|
@ -588,7 +589,7 @@ func (c *LINEChannel) StartTyping(ctx context.Context, chatID string) (func(), e
|
||||||
// classifySDKError maps an SDK HTTP response to the project's sentinel errors.
|
// classifySDKError maps an SDK HTTP response to the project's sentinel errors.
|
||||||
func classifySDKError(resp *http.Response, err error) error {
|
func classifySDKError(resp *http.Response, err error) error {
|
||||||
if resp != nil && resp.Body != nil {
|
if resp != nil && resp.Body != nil {
|
||||||
resp.Body.Close()
|
_ = resp.Body.Close()
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue