Skip to content

Commit

Permalink
Use a named type instead of the an anonymous interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalloc committed Aug 15, 2024
1 parent 4eb23e8 commit 2870872
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions application.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,19 @@ func (c *applicationConfigurer) RegisterProjection(h dogma.ProjectionMessageHand
c.registerIfConfigured(fromProjectionUnvalidated(h))
}

type validatableHandler interface {
RichHandler

// isConfigured returns true if the handler has been configured in any way
// beyond being disabled, even if the configuration is invalid.
isConfigured() bool

// mustValidate panics if the handler is not configured correctly.
mustValidate()
}

func (c *applicationConfigurer) registerIfConfigured(
h interface {
RichHandler
isConfigured() bool
mustValidate()
},
h validatableHandler,
) {
if h.IsDisabled() && !h.isConfigured() {
return
Expand Down

0 comments on commit 2870872

Please sign in to comment.