Skip to content

Commit

Permalink
panic instead of logging and swallowing error
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Lam committed Jan 11, 2024
1 parent 2ecf959 commit e2d6eb4
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions messages/teleporter/message_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package teleporter

import (
"encoding/json"
"errors"
"fmt"
"math/big"

Expand Down Expand Up @@ -298,21 +297,13 @@ func (m *messageManager) parseTeleporterMessage(warpMessageID ids.ID, warpPayloa
func (m *messageManager) getTeleporterMessenger(destinationClient vms.DestinationClient) (*teleportermessenger.TeleporterMessenger, error) {
client, ok := destinationClient.Client().(ethclient.Client)
if !ok {
m.logger.Error(
"Destination client is not an Ethereum client.",
zap.String("destinationBlockchainID", destinationClient.DestinationBlockchainID().String()),
)
return nil, errors.New("destination client is not an Ethereum client")
panic(fmt.Sprintf("Destination client for chain %s is not an Ethereum client", destinationClient.DestinationBlockchainID().String()))
}

// Get the teleporter messenger contract
teleporterMessenger, err := teleportermessenger.NewTeleporterMessenger(common.BytesToAddress(m.protocolAddress[:]), client)
if err != nil {
m.logger.Error(
"Failed to get teleporter messenger contract",
zap.Error(err),
)
return nil, err
panic("Failed to get teleporter messenger contract")
}
return teleporterMessenger, nil
}
Expand Down

0 comments on commit e2d6eb4

Please sign in to comment.