MCPcopy
hub / github.com/larksuite/cli / TestBuildAPIError_LogIDNestedInError

Function TestBuildAPIError_LogIDNestedInError

internal/errclass/classify_test.go:691–709  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

689}
690
691func 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
711func TestBuildAPIError_LogIDTopLevel(t *testing.T) {
712 resp := map[string]any{

Callers

nothing calls this directly

Calls 2

BuildAPIErrorFunction · 0.92
ProblemOfFunction · 0.92

Tested by

no test coverage detected