serialdispatcher.go
func (d *SerialDispatcher) Dispatch(cmd interface{}) (err error) {
	d.mutex.RLock()
	defer d.mutex.RUnlock()

	defer func() {
		if e := recover(); e != nil {
			err = e.(error)
		}
	}()

	found := false
	for _, handler := range d.handlers {
		if handler == nil {
			continue
		}
		if !handler.CanHandle(cmd) {
			continue
		}
		found = true
		if err = handler.Handle(cmd, d); err != nil {
			return
		}
	}

	if !found {
		return &NoHandlerFoundError{
			Command: cmd,
		}
	}

	return
}
func (d *SerialDispatcher) Dispatch(cmd interface{}) (err error) {
	d.mutex.RLock()
	defer d.mutex.RUnlock()

	defer func() {
		if e := recover(); e != nil {
			err = e.(error)
		}
	}()

	found := false
	for _, handler := range d.handlers {
		if handler == nil {
			continue
		}
		if !handler.CanHandle(cmd) {
			continue
		}
		found = true
		if err = handler.Handle(cmd, d); err != nil {
			return
		}
	}

	if !found {
		return &NoHandlerFoundError{
			Command: cmd,
		}
	}

	return
}
func ( d * SerialDispatcher ) Dispatch ( cmd interface { } ) ( err error ) { d . mutex . RLock ( ) defer d . mutex . RUnlock ( ) defer func ( ) { if e := recover ( ) ; e != nil { err = e . ( error ) } } ( ) found := false for _ , handler := range d . handlers { if handler == nil { continue } if ! handler . CanHandle ( cmd ) { continue } found = true if err = handler . Handle ( cmd , d ) ; err != nil { return } } if ! found { return & NoHandlerFoundError { Command : cmd , } } return }
// Dispatch implements `Dispatcher.Dispatch`
Dispatch implements Dispatcher . Dispatch