Select Git revision
cron.go 709 B
package handler_utils
import (
"gitlab.com/uafrica/go-utils/errors"
"gitlab.com/uafrica/go-utils/logs"
)
// ValidateCronHandlers checks that all handlers are correctly defined using one of the supported handler types
// return updated handlers (with additional information -> N/A for cron)
func ValidateCronHandlers(handlers map[string]func() error) (map[string]func() error, error) {
countHandler := 0
for cronName, cronFunc := range handlers {
if cronName == "" {
return nil, errors.Errorf("blank handlerName")
}
if cronFunc == nil {
return nil, errors.Errorf("nil handler on %s", cronName)
}
countHandler++
}
logs.Info("Checked %d handlers\n", countHandler)
return handlers, nil
}