Skip to content

Commit

Permalink
use switch to check for error of type ActivationServiceError
Browse files Browse the repository at this point in the history
  • Loading branch information
Eslam-Nawara committed Sep 9, 2024
1 parent 29842b8 commit 1bd39d9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/substrate_gateway/substrate_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,16 @@ func (g *substrateGateway) EnsureAccount(activationURL []string, termsAndConditi
Msg("method called")
g.mu.Lock()
defer g.mu.Unlock()

for _, url := range activationURL {
info, err = g.sub.EnsureAccount(g.identity, url, termsAndConditionsLink, termsAndConditionsHash)
// check other activationURL only if EnsureAccount failed with ActivationServiceError
if errors.Is(err, substrate.ActivationServiceError{}) {
log.Debug().Str("activation url", url).Err(err).Msg("failed to EnsureAccount with ActivationServiceError")
continue
if err != nil {
switch err.(type) {
case substrate.ActivationServiceError:
log.Debug().Str("activation url", url).Err(err).Msg("failed to EnsureAccount with ActivationServiceError")
continue
}
}
return
}
Expand Down

0 comments on commit 1bd39d9

Please sign in to comment.