mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-08 22:13:26 +09:00
refactor: share package registry error status classification (#39133)
Signed-off-by: silverwind <me@silverwind.io>
This commit is contained in:
@@ -414,11 +414,7 @@ func DownloadPackageFile(ctx *context.Context) {
|
||||
ctx.Req.Method,
|
||||
)
|
||||
if err != nil {
|
||||
if errors.Is(err, packages_model.ErrPackageNotExist) || errors.Is(err, packages_model.ErrPackageFileNotExist) {
|
||||
apiError(ctx, http.StatusNotFound, err)
|
||||
return
|
||||
}
|
||||
apiError(ctx, http.StatusInternalServerError, err)
|
||||
apiError(ctx, helper.PackageErrorStatus(err), err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -667,11 +663,7 @@ func DownloadSymbolFile(ctx *context.Context) {
|
||||
|
||||
s, u, pf, err := packages_service.OpenFileForDownload(ctx, pfs[0], ctx.Req.Method)
|
||||
if err != nil {
|
||||
if errors.Is(err, packages_model.ErrPackageNotExist) || errors.Is(err, packages_model.ErrPackageFileNotExist) {
|
||||
apiError(ctx, http.StatusNotFound, err)
|
||||
return
|
||||
}
|
||||
apiError(ctx, http.StatusInternalServerError, err)
|
||||
apiError(ctx, helper.PackageErrorStatus(err), err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user