Abort watchpr when a poll can no longer see the PR
- treat a mid-run 404 on a tracked PR as terminal - cap consecutive transient poll failures at 20 per PR - reset the failure count on a successful poll - export IsNotFound for callers to classify the abort
This commit is contained in:
@@ -24,8 +24,10 @@ func (e *APIError) Error() string {
|
||||
return fmt.Sprintf("gitea %s %s: HTTP %d: %s", e.Method, e.Path, e.StatusCode, e.Body)
|
||||
}
|
||||
|
||||
// isNotFound reports whether err is a Gitea 404.
|
||||
func isNotFound(err error) bool {
|
||||
// IsNotFound reports whether err is a Gitea 404. Gitea hides repositories a
|
||||
// caller may not see behind a 404 rather than a 403, so this also covers a repo
|
||||
// that was renamed, deleted, or made private.
|
||||
func IsNotFound(err error) bool {
|
||||
var apiErr *APIError
|
||||
return errors.As(err, &apiErr) && apiErr.StatusCode == http.StatusNotFound
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user