Problem :
In routeHandler, the error returned by GetAgency is silently discarded:
agency, err := api.GtfsManager.GtfsDB.Queries.GetAgency(ctx, agencyID)
if err == nil {
// agency added to references
}
// any error, including context.Canceled / context.DeadlineExceeded, is silently dropped
If this DB call fails for any reason — including context.Canceled or context.DeadlineExceeded — the handler skips the agency reference and returns a successful response with incomplete data. Context errors in particular should never be silently ignored.
Expected Behavior
sql.ErrNoRows → agency reference is optional, skip silently and continue
Any other error → route through serverErrorResponse, which already handles context cancellation and deadline exceeded correctly (see internal/restapi/errors.go)
internal/restapi/errors.go — existing pattern that should be used:
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
api.clientCanceledResponse(w, r, err)
return
}
Problem :
In routeHandler, the error returned by GetAgency is silently discarded:
If this DB call fails for any reason — including context.Canceled or context.DeadlineExceeded — the handler skips the agency reference and returns a successful response with incomplete data. Context errors in particular should never be silently ignored.
Expected Behavior
sql.ErrNoRows → agency reference is optional, skip silently and continue
Any other error → route through serverErrorResponse, which already handles context cancellation and deadline exceeded correctly (see internal/restapi/errors.go)
internal/restapi/errors.go — existing pattern that should be used: