Skip to content

Commit

Permalink
Simplify kind switch.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalloc committed Sep 26, 2024
1 parent bd25b53 commit f04a718
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,23 +173,8 @@ func mustHaveProducerRoute(
}
}

verb := ""
routeFunc := ""

message.SwitchKind(
kind,
func() {
verb = "execute"
routeFunc = "ExecutesCommand"
},
func() {
verb = "record"
routeFunc = "RecordsEvent"
},
func() {
panic("no handlers mandate use of timeout messages")
},
)
verb := message.MapKind(kind, "execute", "record", "schedule")
routeFunc := message.MapKind(kind, "ExecutesCommand", "RecordsEvent", "SchedulesTimeout")

validation.Panicf(
`%s is not configured to %s any %ss, at least one %s() route must be added within Configure()`,
Expand Down

0 comments on commit f04a718

Please sign in to comment.