Fix error handling bug introduced in last commit

This commit is contained in:
Amolith 2023-11-28 20:18:56 -05:00
parent 8ca0376243
commit 68be501154
Signed by: Amolith
GPG Key ID: 8AE30347CE28D101
2 changed files with 1 additions and 4 deletions

View File

@ -200,9 +200,6 @@ func GetProject(dbConn *sql.DB, url string) (Project, error) {
if err != nil { if err != nil {
return Project{}, err return Project{}, err
} }
if len(projectDB) == 0 {
return Project{}, nil
}
p := Project{ p := Project{
URL: projectDB["url"], URL: projectDB["url"],
Name: projectDB["name"], Name: projectDB["name"],

View File

@ -74,7 +74,7 @@ func (h Handler) NewHandler(w http.ResponseWriter, r *http.Request) {
} }
proj, err := project.GetProject(h.DbConn, submittedURL) proj, err := project.GetProject(h.DbConn, submittedURL)
if err != nil { if err != nil && err != sql.ErrNoRows {
w.WriteHeader(http.StatusBadRequest) w.WriteHeader(http.StatusBadRequest)
_, err := w.Write([]byte(fmt.Sprintf("Error getting project: %s", err))) _, err := w.Write([]byte(fmt.Sprintf("Error getting project: %s", err)))
if err != nil { if err != nil {