Skip to content

Commit

Permalink
error logging improved
Browse files Browse the repository at this point in the history
  • Loading branch information
ErezLevip committed Dec 29, 2018
1 parent 4bedf5c commit bf86675
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/erezlevip/event-listener"
"github.com/erezlevip/event-listener/types"
"log"
"reflect"
)

type Consumer interface {
Expand Down Expand Up @@ -85,6 +86,11 @@ func (e *EventsConsumer) handleMessages(messages <-chan *types.WrappedEvent) {
func (e *EventsConsumer) handleErrors(topic string, errors <-chan error) {
log.Println("handling errors")
for err := range errors {
Error(e.ctx,&ErrorMetric{
Context:topic,
Function: reflect.TypeOf(e.listener.Listen).Name(),
})

ctx := NewMessageContext(topic, nil, e.ctx, e.logger)
e.router.errorHandlers[topic](err, ctx.ctx)
}
Expand Down

0 comments on commit bf86675

Please sign in to comment.