Skip to content

Commit

Permalink
Add error if --apiKey was not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanConnell committed Dec 30, 2023
1 parent 73cf9ce commit 1a1f0dc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/watcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ type flags struct {
func main() {
f := parseFlags()

// Ticketmaster will give us an authentication error if we don't have an API key.
if f.apiKey == "" {
log.Fatalf("Unable to run without a Ticketmaster API key. " +
"Please pass one via the --apiKey option")
return
}

// Read artists
artists, err := readLines(f.artistFile)
if err != nil {
Expand All @@ -31,7 +38,6 @@ func main() {

reader := ticketmaster.NewReader(f.apiKey)
watcher := watcher.NewWatcher(reader, f.ticketmasterConfigFile, artists, f.discordWebhookURL)

events, err := watcher.FindEvents()
if err != nil {
log.Fatalf("Error retrieving events: %v", err)
Expand Down

0 comments on commit 1a1f0dc

Please sign in to comment.