From b2a3496a242e97c9277d71993be540bdc5859dd3 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Fri, 24 May 2024 14:05:35 +0200 Subject: [PATCH] Avoid panic for "search flights on airline" It prefers a fail job rather than a process panic --- internal/handlers/acmesky/tm_search_flight_on_airline.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/handlers/acmesky/tm_search_flight_on_airline.go b/internal/handlers/acmesky/tm_search_flight_on_airline.go index a4591d1..b996bf3 100644 --- a/internal/handlers/acmesky/tm_search_flight_on_airline.go +++ b/internal/handlers/acmesky/tm_search_flight_on_airline.go @@ -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{}{}