fix: resolve merge conflicts in wecom error handling
Combine both shadow variable fix (readErr) and proper error classification (ClassifySendError) in wecom app and bot channels.
This commit is contained in:
parent
b878272962
commit
03d6ad420f
2 changed files with 11 additions and 22 deletions
|
|
@ -321,17 +321,12 @@ func (c *WeComAppChannel) uploadMedia(ctx context.Context, accessToken, mediaTyp
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
<<<<<<< HEAD
|
|
||||||
respBody, err := io.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
return "", channels.ClassifySendError(resp.StatusCode, fmt.Errorf("reading wecom upload error response: %w", err))
|
|
||||||
=======
|
|
||||||
respBody, readErr := io.ReadAll(resp.Body)
|
respBody, readErr := io.ReadAll(resp.Body)
|
||||||
if readErr != nil {
|
if readErr != nil {
|
||||||
return "", fmt.Errorf(
|
return "", channels.ClassifySendError(
|
||||||
"reading wecom upload error response: %w", readErr,
|
resp.StatusCode,
|
||||||
|
fmt.Errorf("reading wecom upload error response: %w", readErr),
|
||||||
)
|
)
|
||||||
>>>>>>> 908fa8d (fix: resolve govet shadow and golines lint errors in wecom channels)
|
|
||||||
}
|
}
|
||||||
return "", channels.ClassifySendError(
|
return "", channels.ClassifySendError(
|
||||||
resp.StatusCode,
|
resp.StatusCode,
|
||||||
|
|
@ -385,15 +380,12 @@ func (c *WeComAppChannel) sendWeComMessage(ctx context.Context, accessToken stri
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
<<<<<<< HEAD
|
|
||||||
respBody, err := io.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
return channels.ClassifySendError(resp.StatusCode, fmt.Errorf("reading wecom_app error response: %w", err))
|
|
||||||
=======
|
|
||||||
respBody, readErr := io.ReadAll(resp.Body)
|
respBody, readErr := io.ReadAll(resp.Body)
|
||||||
if readErr != nil {
|
if readErr != nil {
|
||||||
return fmt.Errorf("reading wecom_app error response: %w", readErr)
|
return channels.ClassifySendError(
|
||||||
>>>>>>> 908fa8d (fix: resolve govet shadow and golines lint errors in wecom channels)
|
resp.StatusCode,
|
||||||
|
fmt.Errorf("reading wecom_app error response: %w", readErr),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return channels.ClassifySendError(
|
return channels.ClassifySendError(
|
||||||
resp.StatusCode,
|
resp.StatusCode,
|
||||||
|
|
|
||||||
|
|
@ -453,15 +453,12 @@ func (c *WeComBotChannel) sendWebhookReply(ctx context.Context, userID, content
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
<<<<<<< HEAD
|
|
||||||
body, err := io.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
return channels.ClassifySendError(resp.StatusCode, fmt.Errorf("reading webhook error response: %w", err))
|
|
||||||
=======
|
|
||||||
body, readErr := io.ReadAll(resp.Body)
|
body, readErr := io.ReadAll(resp.Body)
|
||||||
if readErr != nil {
|
if readErr != nil {
|
||||||
return fmt.Errorf("reading webhook error response: %w", readErr)
|
return channels.ClassifySendError(
|
||||||
>>>>>>> 908fa8d (fix: resolve govet shadow and golines lint errors in wecom channels)
|
resp.StatusCode,
|
||||||
|
fmt.Errorf("reading webhook error response: %w", readErr),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return channels.ClassifySendError(
|
return channels.ClassifySendError(
|
||||||
resp.StatusCode,
|
resp.StatusCode,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue