lots of post-DB cleanup
This commit is contained in:
parent
965d6f5c3e
commit
c9d950d2b2
23 changed files with 412 additions and 550 deletions
18
api/api.go
18
api/api.go
|
@ -21,8 +21,12 @@ func Handler() http.Handler {
|
|||
var artist model.Artist
|
||||
err := global.DB.Get(&artist, "SELECT * FROM artist WHERE id=$1", artistID)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "no rows") {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
fmt.Printf("FATAL: Error while retrieving artist %s: %s\n", artistID, err)
|
||||
http.NotFound(w, r)
|
||||
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -60,8 +64,12 @@ func Handler() http.Handler {
|
|||
var release model.Release
|
||||
err := global.DB.Get(&release, "SELECT * FROM musicrelease WHERE id=$1", releaseID)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "no rows") {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
fmt.Printf("FATAL: Error while retrieving release %s: %s\n", releaseID, err)
|
||||
http.NotFound(w, r)
|
||||
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -99,8 +107,12 @@ func Handler() http.Handler {
|
|||
var track model.Track
|
||||
err := global.DB.Get(&track, "SELECT * FROM musictrack WHERE id=$1", trackID)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "no rows") {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
fmt.Printf("FATAL: Error while retrieving track %s: %s\n", trackID, err)
|
||||
http.NotFound(w, r)
|
||||
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue