diff --git a/server.go b/server.go index 3a94d40..fd53a9d 100644 --- a/server.go +++ b/server.go @@ -72,9 +72,13 @@ func handler(ctx *fasthttp.RequestCtx) { var code int err := row.Scan(&id, &code) - if err != nil { + if err == sql.ErrNoRows { ctx.Response.SetStatusCode(404) return + } else if err != nil { + ctx.Response.SetStatusCode(500) + ctx.Response.SetBodyString("Unable to fetch row: " + err.Error()) + return } // -- set status code