fix:#52 added error handling

This commit is contained in:
Elmar Kresse
2024-04-07 09:57:07 +02:00
parent c331224066
commit 6276802c36

View File

@ -227,17 +227,15 @@ func getWeekEvents(start time.Time, end time.Time, cycle string) ([]time.Time, [
days := dayRegExp.FindAllString(cyclePart, 2)
startHour, startMinute, endHour, endMinute := extractStartAndEndTime(cyclePart)
//create a int array with all days from start to end day
var startI, endI int
var err error
var endIErr, startIErr error
startI, startIErr = getDayInt(days[0])
endI, endIErr = getDayInt(days[1])
startI, err = getDayInt(days[0])
endI, err = getDayInt(days[1])
if err != nil {
slog.Error("Error while getting day int", err)
if endIErr != nil || startIErr != nil {
slog.Error("Error while getting day int", startIErr, endIErr)
} else {
//create a int array with all days from start to end day
var daysBetween []int
for i := startI; i <= endI; i++ {
daysBetween = append(daysBetween, i)