1 package emperror 2 3 // compositeHandler allows an error to be processed by multiple handlers. 4 type compositeHandler struct { 5 handlers []Handler 6 } 7 8 // NewCompositeHandler returns a new compositeHandler. 9 func NewCompositeHandler(handlers ...Handler) Handler { 10 return &compositeHandler{handlers} 11 } 12 13 // Handle goes through the handlers and call each of them for the error. 14 func (h *compositeHandler) Handle(err error) { 15 for _, handler := range h.handlers { 16 handler.Handle(err) 17 } 18 } 19