mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
refactor(services): leave CLI flag and command names to the app layer
Services report ErrRunScanExhausted, ErrMaxPages and plain conflicts, and the commands add the --branch/--max-pages/--force hints. Unknown label names use the shared NotFoundError, and the repository-scoped review and team search refusal moves into tea search's own usage check. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
10 files changed
+37
-18
No files matched your search
@@ -29,6 +29,9 @@ type APIOptions struct {
|
||||
MaxPages int
|
||||
}
|
||||
|
||||
// ErrMaxPages reports a paginated request that has more pages than APIOptions.MaxPages allows.
|
||||
var ErrMaxPages = errors.New("API pagination exceeded the page limit")
|
||||
|
||||
func nextPageLinks(headers []string) ([]string, error) {
|
||||
result := []string{}
|
||||
for _, header := range headers {
|
||||
@@ -141,7 +144,7 @@ func (s API) Visit(ctx context.Context, options APIOptions, visit func(*http.Res
|
||||
return nil
|
||||
}
|
||||
if page+1 >= options.MaxPages {
|
||||
return errors.New("API pagination exceeded --max-pages")
|
||||
return ErrMaxPages
|
||||
}
|
||||
if _, err := s.Client.URL(next); err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user