Skip to content

Commit

Permalink
dashboard/app: bad inputs are client errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tarasmadan committed Oct 1, 2024
1 parent 5729ee3 commit ea2b66a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dashboard/app/graphs.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,12 @@ func handleHeatmap(c context.Context, w http.ResponseWriter, r *http.Request, f
periodType = coveragedb.DayPeriod
}
if periodType != coveragedb.DayPeriod && periodType != coveragedb.MonthPeriod {
return fmt.Errorf("only day and month are allowed, but received %s instead", periodType)
return fmt.Errorf("only day and month are allowed, but received %s instead, %w",
periodType, ErrClientBadRequest)
}
pOps, err := coveragedb.PeriodOps(periodType)
if err != nil {
return err
return fmt.Errorf("%s: %w", err.Error(), ErrClientBadRequest)
}
periods := coveragedb.GenNPeriodsTill(12, civil.DateOf(time.Now()), pOps)
var style template.CSS
Expand Down

0 comments on commit ea2b66a

Please sign in to comment.