Skip to content

Commit

Permalink
Avoid panic for "search flights on airline"
Browse files Browse the repository at this point in the history
It prefers a fail job rather than a process panic
  • Loading branch information
boozec committed May 24, 2024
1 parent 4eea433 commit b2a3496
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/handlers/acmesky/tm_search_flight_on_airline.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ func TMSearchFlightsOnAirline(client worker.JobClient, job entities.Job) {

interests := variables["interests"].([]interface{})
if index < 0 || index >= len(interests) {
panic("Index out of range")
log.Errorf("Error for airline `%s`: index out of range %d", airline, index)
acmejob.FailJob(client, job)
return
}

flights := []map[string]interface{}{}
Expand Down

0 comments on commit b2a3496

Please sign in to comment.