MCPcopy Create free account
hub / github.com/cli/cli / forbiddenError

Function forbiddenError

pkg/cmd/event/client/client.go:257–264  ·  view source on GitHub ↗

forbiddenError tells a 403 response for an account without preview access apart from other denials. It keeps the HTTP error wrapped, so callers treat it as final rather than retrying it.

(httpErr api.HTTPError, err error)

Source from the content-addressed store, hash-verified

255// forbiddenError tells a 403 response for an account without preview access apart from other denials. It keeps the
256// HTTP error wrapped, so callers treat it as final rather than retrying it.
257func forbiddenError(httpErr api.HTTPError, err error) error {
258 // This check is temporary and can be removed once event subscriptions are enabled for all users.
259 if isPreviewNotEnabled(httpErr) {
260 return fmt.Errorf("%w: %w\nTo join the preview waitlist, see: %s",
261 ErrPreviewNotEnabled, err, previewDocsURL)
262 }
263 return fmt.Errorf("access forbidden: %w", err)
264}
265
266func isPreviewNotEnabled(httpErr api.HTTPError) bool {
267 if httpErr.HTTPError == nil {

Callers 5

CreateSubscriptionMethod · 0.85
GetSubscriptionMethod · 0.85
ListSubscriptionsMethod · 0.85
DeleteSubscriptionMethod · 0.85
OpenStreamMethod · 0.85

Calls 2

isPreviewNotEnabledFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected