Fix error handling bug introduced in last commit
This commit is contained in:
parent
8ca0376243
commit
68be501154
|
@ -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"],
|
||||||
|
|
2
ws/ws.go
2
ws/ws.go
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue