(t *testing.T)
| 689 | } |
| 690 | |
| 691 | func TestBuildAPIError_LogIDNestedInError(t *testing.T) { |
| 692 | // Some Lark API responses carry log_id nested under "error" rather than |
| 693 | // at the top level. BuildAPIError must surface either location. |
| 694 | resp := map[string]any{ |
| 695 | "code": 99991679, |
| 696 | "msg": "missing scope", |
| 697 | "error": map[string]any{ |
| 698 | "log_id": "lg-nested-123", |
| 699 | }, |
| 700 | } |
| 701 | err := errclass.BuildAPIError(resp, errclass.ClassifyContext{Brand: "feishu", AppID: "cli_x", Identity: "user"}) |
| 702 | p, ok := errs.ProblemOf(err) |
| 703 | if !ok { |
| 704 | t.Fatalf("ProblemOf returned !ok, err = %T", err) |
| 705 | } |
| 706 | if p.LogID != "lg-nested-123" { |
| 707 | t.Errorf("LogID = %q, want lg-nested-123", p.LogID) |
| 708 | } |
| 709 | } |
| 710 | |
| 711 | func TestBuildAPIError_LogIDTopLevel(t *testing.T) { |
| 712 | resp := map[string]any{ |
nothing calls this directly
no test coverage detected