Why this matters
Communicates proper semantics to clients and avoids noisy error logs.
Rescue RecordNotFound and return 404 (or domain-appropriate response) instead of 500.
Communicates proper semantics to clients and avoids noisy error logs.
Side-by-side examples engineers can pattern-match during review.
User.find(params[:id]) # bubbles to 500User.find(params[:id])
rescue ActiveRecord::RecordNotFound
head :not_foundfind(id) without rescuerescue ActiveRecord::RecordNotFound { head :not_found }From the same buckets as this rule.