Tell the user when they don't give us an address

Issue: #25
This commit is contained in:
Eli Ribble 2026-05-24 21:27:16 +00:00
parent 34f4980ad5
commit f4756637d6
No known key found for this signature in database
5 changed files with 67 additions and 48 deletions

View file

@ -2,6 +2,7 @@ package resource
import (
"context"
"errors"
"net/http"
"slices"
"time"
@ -125,6 +126,9 @@ func (res *nuisanceR) Create(ctx context.Context, r *http.Request, n nuisanceFor
}
report, err := platform.PublicReportNuisanceCreate(ctx, setter_report, setter_nuisance, n.Location, n.Address, uploads)
if err != nil {
if errors.Is(err, platform.ErrNoAddress) {
return nil, nhttp.NewBadRequest("empty-address")
}
return nil, nhttp.NewError("create nuisance report: %w", err)
}
uri, err := res.router.IDStrToURI("publicreport.ByIDGetPublic", report.PublicID)