From 1416e09d4b8f0c8fac8c31b799c5c3040ea06b7b Mon Sep 17 00:00:00 2001 From: Kirill Date: Thu, 16 Jan 2025 11:37:42 +0400 Subject: [PATCH] Fix autoconversion of types.Error(nil) into non nil error (#122) --- internal/services/bootstrap.go | 6 +----- internal/services/events.go | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/internal/services/bootstrap.go b/internal/services/bootstrap.go index 21663f6..cdca25b 100644 --- a/internal/services/bootstrap.go +++ b/internal/services/bootstrap.go @@ -56,11 +56,7 @@ func (s *Service) processBlocksSequentially(ctx context.Context) error { for i := lastProcessedHeight + 1; i <= uint64(latestHeight); i++ { select { case <-ctx.Done(): - return types.NewError( - http.StatusInternalServerError, - types.InternalServiceError, - fmt.Errorf("context cancelled during block processing"), - ) + return fmt.Errorf("context cancelled during block processing") default: events, err := s.getEventsFromBlock(ctx, int64(i)) if err != nil { diff --git a/internal/services/events.go b/internal/services/events.go index 19767e3..02983d9 100644 --- a/internal/services/events.go +++ b/internal/services/events.go @@ -53,7 +53,7 @@ func (s *Service) processEvent( // process the event based on its type. bbnEvent := event.Event - var err error + var err *types.Error switch EventTypes(bbnEvent.Type) { case EventFinalityProviderCreatedType: