MCPcopy Index your code
hub / github.com/larksuite/cli / TestWrapDoAPIError_Timeout

Function TestWrapDoAPIError_Timeout

internal/client/api_errors_test.go:74–86  ·  view source on GitHub ↗

TestWrapDoAPIError_Timeout pins that an SDK transport error whose chain carries a net.Error with Timeout()==true classifies as NetworkError{Subtype: timeout}. Covers the E2E timeout scenario (HTTPS_PROXY pointing at a non-routable address).

(t *testing.T)

Source from the content-addressed store, hash-verified

72// NetworkError{Subtype: timeout}. Covers the E2E timeout scenario
73// (HTTPS_PROXY pointing at a non-routable address).
74func TestWrapDoAPIError_Timeout(t *testing.T) {
75 got := WrapDoAPIError(&net.OpError{Op: "dial", Net: "tcp", Err: timeoutNetError{}})
76 var ne *errs.NetworkError
77 if !errors.As(got, &ne) {
78 t.Fatalf("expected *errs.NetworkError, got %T (%v)", got, got)
79 }
80 if ne.Subtype != errs.SubtypeNetworkTimeout {
81 t.Errorf("Subtype = %v, want %v", ne.Subtype, errs.SubtypeNetworkTimeout)
82 }
83 if ne.Category != errs.CategoryNetwork {
84 t.Errorf("Category = %v, want %v", ne.Category, errs.CategoryNetwork)
85 }
86}
87
88// TestWrapDoAPIError_TLS pins that an x509.UnknownAuthorityError classifies
89// as NetworkError{Subtype: tls}.

Callers

nothing calls this directly

Calls 2

WrapDoAPIErrorFunction · 0.85
AsMethod · 0.80

Tested by

no test coverage detected