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)
| 244 | // forbiddenError tells a 403 response for an account without preview access apart from other denials. It keeps the |
| 245 | // HTTP error wrapped, so callers treat it as final rather than retrying it. |
| 246 | func forbiddenError(httpErr api.HTTPError, err error) error { |
| 247 | // This check is temporary and can be removed once event subscriptions are enabled for all users. |
| 248 | if httpErr.HTTPError != nil && httpErr.Message == previewNotEnabledMessage { |
| 249 | return fmt.Errorf("%w: %w", ErrPreviewNotEnabled, err) |
| 250 | } |
| 251 | return fmt.Errorf("access forbidden: %w", err) |
| 252 | } |
| 253 | |
| 254 | // SupportedHost reports whether event subscriptions are available on host. They are only available on github.com, |
| 255 | // not on GitHub Enterprise Server or GHE.com. |
no test coverage detected