You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
forgejo/models/repo
zeripath 716fcfcf72
Make every not exist error unwrappable to a fs.ErrNotExist (#20891)
A lot of our code is repeatedly testing if individual errors are
specific types of Not Exist errors. This is repetitative and unnecesary.
`Unwrap() error` provides a common way of labelling an error as a
NotExist error and we can/should use this.

This PR has chosen to use the common `io/fs` errors e.g.
`fs.ErrNotExist` for our errors. This is in some ways not completely
correct as these are not filesystem errors but it seems like a
reasonable thing to do and would allow us to simplify a lot of our code
to `errors.Is(err, fs.ErrNotExist)` instead of
`package.IsErr...NotExist(err)`

I am open to suggestions to use a different base error - perhaps
`models/db.ErrNotExist` if that would be felt to be better.


Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: delvh <dev.lh@web.de>
2 years ago
..
archiver.go fix hard-coded timeout and error panic in API archive download endpoint (#20925) 2 years ago
attachment.go Make every not exist error unwrappable to a fs.ErrNotExist (#20891) 2 years ago
attachment_test.go Move some repository related code into sub package (#19711) 2 years ago
avatar.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
collaboration.go Move some code into models/git (#19879) 2 years ago
collaboration_test.go Refactor AssertExistsAndLoadBean to use generics (#20797) 2 years ago
fork.go Feature: Find files in repo (#15028) 2 years ago
fork_test.go Move some repository related code into sub package (#19711) 2 years ago
git.go Move repository model into models/repo (#17933) 3 years ago
issue.go Prevent deadlock in create issue (#17970) 3 years ago
language_stats.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
main_test.go Feature: Find files in repo (#15028) 2 years ago
mirror.go In PushMirrorsIterate and MirrorsIterate if limit is negative do not set it (#20837) 2 years ago
pushmirror.go In PushMirrorsIterate and MirrorsIterate if limit is negative do not set it (#20837) 2 years ago
pushmirror_test.go Add new API endpoints for push mirrors management (#19841) 2 years ago
redirect.go Make every not exist error unwrappable to a fs.ErrNotExist (#20891) 2 years ago
redirect_test.go Refactor AssertExistsAndLoadBean to use generics (#20797) 2 years ago
release.go Make every not exist error unwrappable to a fs.ErrNotExist (#20891) 2 years ago
repo.go Make every not exist error unwrappable to a fs.ErrNotExist (#20891) 2 years ago
repo_indexer.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
repo_list.go Add generic set type (#21408) 2 years ago
repo_list_test.go Move some repository related code into sub package (#19711) 2 years ago
repo_test.go Refactor AssertExistsAndLoadBean to use generics (#20797) 2 years ago
repo_unit.go Make every not exist error unwrappable to a fs.ErrNotExist (#20891) 2 years ago
star.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
star_test.go Refactor AssertExistsAndLoadBean to use generics (#20797) 2 years ago
topic.go Make every not exist error unwrappable to a fs.ErrNotExist (#20891) 2 years ago
topic_test.go Move some repository related code into sub package (#19711) 2 years ago
update.go Make every not exist error unwrappable to a fs.ErrNotExist (#20891) 2 years ago
upload.go Make every not exist error unwrappable to a fs.ErrNotExist (#20891) 2 years ago
user_repo.go Add generic set type (#21408) 2 years ago
user_repo_test.go Refactor AssertExistsAndLoadBean to use generics (#20797) 2 years ago
watch.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
watch_test.go Refactor AssertExistsAndLoadBean to use generics (#20797) 2 years ago
wiki.go Make every not exist error unwrappable to a fs.ErrNotExist (#20891) 2 years ago
wiki_test.go Refactor AssertExistsAndLoadBean to use generics (#20797) 2 years ago