Skip to content

Commit

Permalink
added check to avoid handlername conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
facchettos committed Apr 5, 2024
1 parent 196837d commit 1de06bd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugin/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,10 @@ func (m *manager) Register(syncer syncertypes.Base) error {
defer m.m.Unlock()

if int, ok := syncer.(Interceptor); ok {
m.interceptors[int.Name()] = int.Handler()
if _, ok := m.interceptors[int.Config().HandlerName]; ok {
return fmt.Errorf("could not add the interceptor %s because the handler name %s is already in use", int.Name(), int.Config().HandlerName)
}
m.interceptors[int.Config().HandlerName] = int.Handler()
} else {
m.syncers = append(m.syncers, syncer)
}
Expand Down

0 comments on commit 1de06bd

Please sign in to comment.