|
5 | 5 | "context"
|
6 | 6 | "encoding/base64"
|
7 | 7 | "fmt"
|
| 8 | + "errors" |
8 | 9 | "github.com/google/uuid"
|
9 | 10 | larkcard "github.com/larksuite/oapi-sdk-go/v3/card"
|
10 | 11 | larkim "github.com/larksuite/oapi-sdk-go/v3/service/im/v1"
|
@@ -67,7 +68,7 @@ func replyCard(ctx context.Context,
|
67 | 68 | // 服务端错误处理
|
68 | 69 | if !resp.Success() {
|
69 | 70 | fmt.Println(resp.Code, resp.Msg, resp.RequestId())
|
70 |
| - return err |
| 71 | + return errors.New(resp.Msg) |
71 | 72 | }
|
72 | 73 | return nil
|
73 | 74 | }
|
@@ -432,7 +433,7 @@ func replyMsg(ctx context.Context, msg string, msgId *string) error {
|
432 | 433 | // 服务端错误处理
|
433 | 434 | if !resp.Success() {
|
434 | 435 | fmt.Println(resp.Code, resp.Msg, resp.RequestId())
|
435 |
| - return err |
| 436 | + return errors.New(resp.Msg) |
436 | 437 | }
|
437 | 438 | return nil
|
438 | 439 | }
|
@@ -461,7 +462,7 @@ func uploadImage(base64Str string) (*string, error) {
|
461 | 462 | // 服务端错误处理
|
462 | 463 | if !resp.Success() {
|
463 | 464 | fmt.Println(resp.Code, resp.Msg, resp.RequestId())
|
464 |
| - return nil, err |
| 465 | + return nil, errors.New(resp.Msg) |
465 | 466 | }
|
466 | 467 | return resp.Data.ImageKey, nil
|
467 | 468 | }
|
@@ -495,7 +496,7 @@ func replyImage(ctx context.Context, ImageKey *string,
|
495 | 496 | // 服务端错误处理
|
496 | 497 | if !resp.Success() {
|
497 | 498 | fmt.Println(resp.Code, resp.Msg, resp.RequestId())
|
498 |
| - return err |
| 499 | + return errors.New(resp.Msg) |
499 | 500 | }
|
500 | 501 | return nil
|
501 | 502 |
|
@@ -580,7 +581,7 @@ func sendMsg(ctx context.Context, msg string, chatId *string) error {
|
580 | 581 | // 服务端错误处理
|
581 | 582 | if !resp.Success() {
|
582 | 583 | fmt.Println(resp.Code, resp.Msg, resp.RequestId())
|
583 |
| - return err |
| 584 | + return errors.New(resp.Msg) |
584 | 585 | }
|
585 | 586 | return nil
|
586 | 587 | }
|
|
0 commit comments