forked from kevadesu/forgejo
Updates to API 404 responses (#6077)
This commit is contained in:
parent
d10a668ffc
commit
cac9e6e760
30 changed files with 120 additions and 91 deletions
|
@ -40,14 +40,14 @@ func GetRawFile(ctx *context.APIContext) {
|
|||
// 200:
|
||||
// description: success
|
||||
if ctx.Repo.Repository.IsEmpty {
|
||||
ctx.Status(404)
|
||||
ctx.NotFound()
|
||||
return
|
||||
}
|
||||
|
||||
blob, err := ctx.Repo.Commit.GetBlobByPath(ctx.Repo.TreePath)
|
||||
if err != nil {
|
||||
if git.IsErrNotExist(err) {
|
||||
ctx.Status(404)
|
||||
ctx.NotFound()
|
||||
} else {
|
||||
ctx.Error(500, "GetBlobByPath", err)
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ func GetEditorconfig(ctx *context.APIContext) {
|
|||
ec, err := ctx.Repo.GetEditorconfig()
|
||||
if err != nil {
|
||||
if git.IsErrNotExist(err) {
|
||||
ctx.Error(404, "GetEditorconfig", err)
|
||||
ctx.NotFound(err)
|
||||
} else {
|
||||
ctx.Error(500, "GetEditorconfig", err)
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ func GetEditorconfig(ctx *context.APIContext) {
|
|||
fileName := ctx.Params("filename")
|
||||
def := ec.GetDefinitionForFilename(fileName)
|
||||
if def == nil {
|
||||
ctx.Error(404, "GetDefinitionForFilename", err)
|
||||
ctx.NotFound(err)
|
||||
return
|
||||
}
|
||||
ctx.JSON(200, def)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue