Exemple #1
0
func (c *ComposedHandler) callMap(h bh.Handler, msg bh.Msg, ctx bh.MapContext) (
	cells bh.MappedCells, err error) {

	defer func() {
		if r := recover(); r != nil {
			err = errors.New(fmt.Sprintf("%v", r))
		}
	}()

	cells = h.Map(msg, ctx)
	if cells == nil {
		err = fmt.Errorf("%#v drops the msg", h)
	}
	return
}
Exemple #2
0
func (c *ComposedHandler) callRcv(h bh.Handler, msg bh.Msg, ctx bh.RcvContext) (
	err error) {

	defer func() {
		r := recover()
		if r == nil {
			return
		}

		if d, ok := r.(time.Duration); ok {
			ctx.Snooze(d)
		}

		err = errors.New(fmt.Sprintf("%v", r))
	}()

	return h.Rcv(msg, ctx)
}