Skip to content

Commit

Permalink
Add logs and improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
muralov committed Sep 12, 2023
1 parent f57472d commit ea88ae0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion hack/e2e/sink/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ func main() {
sHandler := handler.NewSinkHandler(logger)
err = sHandler.Start(port)
if err != nil {
logger.Error("failed to start SinkHandler", zap.Error(err))
logger.Fatal("failed to start SinkHandler", zap.Error(err))
}
}
4 changes: 1 addition & 3 deletions hack/e2e/sink/internal/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ type sinkEvent struct {
}

func (h *SinkHandler) StoreEvent(w http.ResponseWriter, r *http.Request) {

// TODO: event received information with headers and body

event, err := extractCloudEventFromRequest(r)
if err != nil {
h.namedLogger().With().Error("failed to extract CloudEvent from request", zap.Error(err))
Expand All @@ -61,6 +58,7 @@ func (h *SinkHandler) StoreEvent(w http.ResponseWriter, r *http.Request) {
}
return
}
h.namedLogger().With().Info("received", zap.String("event", event.String()))

// store the event in memory
h.events[event.ID()] = &sinkEvent{
Expand Down

0 comments on commit ea88ae0

Please sign in to comment.