0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-25 15:05:35 +01:00
gitea/modules
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>
2022-10-18 07:50:37 +02:00
..
activitypub
analyze
auth
avatar Go 1.19 format (#20758) 2022-08-30 21:15:45 -05:00
base Add generic set type (#21408) 2022-10-12 13:18:26 +08:00
cache
charset Move go-licenses to generate and separate generate into a frontend and backend component (#21061) 2022-09-05 14:04:18 +08:00
container Add generic set type (#21408) 2022-10-12 13:18:26 +08:00
context Redirect to new repository owner (#21398) 2022-10-11 19:54:44 +08:00
convert Use Name instead of DisplayName in LFS Lock (#21415) 2022-10-11 21:03:15 -04:00
csv Go 1.19 format (#20758) 2022-08-30 21:15:45 -05:00
doctor Add HEAD fix to gitea doctor (#21352) 2022-10-12 12:17:55 -04:00
emoji Go 1.19 format (#20758) 2022-08-30 21:15:45 -05:00
eventsource
generate
git Make every not exist error unwrappable to a fs.ErrNotExist (#20891) 2022-10-18 07:50:37 +02:00
gitgraph alternative to PR "improve code quality" (#21464) 2022-10-15 12:49:26 +02:00
graceful
hcaptcha
highlight Upgrade chroma to v2.3.0 (#21259) 2022-09-26 13:50:03 +08:00
hostmatcher
httpcache
httplib
indexer test: use T.TempDir to create temporary test directory (#21043) 2022-09-04 16:14:53 +01:00
issue/template Add generic set type (#21408) 2022-10-12 13:18:26 +08:00
json
lfs
log test: use T.TempDir to create temporary test directory (#21043) 2022-09-04 16:14:53 +01:00
markup Add generic set type (#21408) 2022-10-12 13:18:26 +08:00
mcaptcha
metrics
migration Add more checks in migration code (#21011) 2022-09-04 13:47:56 +03:00
mirror
nosql
notification Display total commit count in hook message (#21400) 2022-10-17 00:22:34 +08:00
options Fix and improve incorrect error messages (#21342) 2022-10-06 07:00:54 +01:00
packages Add support for Chocolatey/NuGet v2 API (#21393) 2022-10-13 18:19:39 +08:00
paginator
password
pprof Go 1.19 format (#20758) 2022-08-30 21:15:45 -05:00
private log real ip of requests from ssh (#21216) 2022-10-11 16:57:37 +08:00
process
proxy
proxyprotocol
public Add generic set type (#21408) 2022-10-12 13:18:26 +08:00
queue Add generic set type (#21408) 2022-10-12 13:18:26 +08:00
recaptcha
references
regexplru
repository Add system setting table with cache and also add cache supports for user setting (#18058) 2022-10-17 07:29:26 +08:00
secret
session
setting Add system setting table with cache and also add cache supports for user setting (#18058) 2022-10-17 07:29:26 +08:00
sitemap
ssh
storage Save files in local storage as umask (#21198) 2022-09-24 21:04:14 +08:00
structs Display total commit count in hook message (#21400) 2022-10-17 00:22:34 +08:00
svg
sync Add generic set type (#21408) 2022-10-12 13:18:26 +08:00
system Add system setting table with cache and also add cache supports for user setting (#18058) 2022-10-17 07:29:26 +08:00
templates Add system setting table with cache and also add cache supports for user setting (#18058) 2022-10-17 07:29:26 +08:00
test
timeutil
translation Make every not exist error unwrappable to a fs.ErrNotExist (#20891) 2022-10-18 07:50:37 +02:00
typesniffer
updatechecker Add system setting table with cache and also add cache supports for user setting (#18058) 2022-10-17 07:29:26 +08:00
upload
uri
user
util Make every not exist error unwrappable to a fs.ErrNotExist (#20891) 2022-10-18 07:50:37 +02:00
validation Add more checks in migration code (#21011) 2022-09-04 13:47:56 +03:00
watcher
web