magneticow: api: return 404 when the resource is not found
This commit is contained in:
parent
4c4dc1c173
commit
74ca0cac13
@ -107,6 +107,9 @@ func apiTorrentsInfohashHandler(w http.ResponseWriter, r *http.Request) {
|
||||
if err != nil {
|
||||
respondError(w, 500, "couldn't get torrent: %s", err.Error())
|
||||
return
|
||||
} else if torrent == nil {
|
||||
respondError(w, 404, "not found")
|
||||
return
|
||||
}
|
||||
|
||||
// TODO: use plain Marshal
|
||||
@ -134,6 +137,9 @@ func apiFilesInfohashHandler(w http.ResponseWriter, r *http.Request) {
|
||||
if err != nil {
|
||||
respondError(w, 500, "couldn't get files: %s", err.Error())
|
||||
return
|
||||
} else if files == nil {
|
||||
respondError(w, 404, "not found")
|
||||
return
|
||||
}
|
||||
|
||||
// TODO: use plain Marshal
|
||||
|
Loading…
Reference in New Issue
Block a user