mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
chore: handle error types consistently (#9873)
Some error types are used inconsistently or wrong: - `forgejo.org/modules/git.ErrNotExist` is meant to be a value error: <[modules/git/error.go#L23](https://codeberg.org/forgejo/forgejo/src/tag/v13.0.2/modules/git/error.go#L23)> - `forgejo.org/models/repo.ErrRepoNotExist` is meant to be a value error: <[models/repo/repo.go#L750](https://codeberg.org/forgejo/forgejo/src/tag/v13.0.2/models/repo/repo.go#L750)> - `errors.Is(logErr, &net.OpError{})` is always `false`: <[services/context/context_response.go#L188](https://codeberg.org/forgejo/forgejo/src/tag/v13.0.2/services/context/context_response.go#L188)> - `forgejo.org/models/issues.ErrIssueContentHistoryNotExist` is used inconsistently: <[models/issues/content_history.go#L211](https://codeberg.org/forgejo/forgejo/src/tag/v13.0.2/models/issues/content_history.go#L211)> Decided to use a value, since the structure is small and to be in line with the above errors. These issued where found with the [errortype](https://codeberg.org/fillmore-labs/errortype) linter and add this to Makefile as part of the linter suite. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9873 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Oliver Eikemeier <eikemeier@fillmore-labs.com> Co-committed-by: Oliver Eikemeier <eikemeier@fillmore-labs.com>
This commit is contained in:
parent
06f0788e00
commit
757eb2f267
6 changed files with 10 additions and 6 deletions
|
|
@ -222,7 +222,7 @@ func GetIssueContentHistoryAndPrev(dbCtx context.Context, issueID, id int64) (hi
|
|||
return nil, nil, err
|
||||
} else if !has {
|
||||
log.Error("issue content history does not exist. id=%v. err=%v", id, err)
|
||||
return nil, nil, &ErrIssueContentHistoryNotExist{id}
|
||||
return nil, nil, ErrIssueContentHistoryNotExist{id}
|
||||
}
|
||||
|
||||
prevHistory = &ContentHistory{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue