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)
| 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. |
| 257 | func 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 | |
| 266 | func isPreviewNotEnabled(httpErr api.HTTPError) bool { |
| 267 | if httpErr.HTTPError == nil { |
no test coverage detected