Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
added log errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikelle committed Apr 9, 2024
1 parent ba3bb14 commit 317c78d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func NewNode(opts *Options) (*Node, error) {

contractRPC, err := ethclient.Dial(opts.RPCEndpoint)
if err != nil {
opts.Logger.Error("failed to connect to rpc", "error", err)
return nil, err
}
evmClient, err := evmclient.New(
Expand All @@ -91,6 +92,7 @@ func NewNode(opts *Options) (*Node, error) {
opts.Logger.With("component", "evmclient"),
)
if err != nil {
opts.Logger.Error("failed to create evm client", "error", err)
return nil, err
}
nd.closers = append(nd.closers, evmClient)
Expand Down Expand Up @@ -118,11 +120,13 @@ func NewNode(opts *Options) (*Node, error) {
case p2p.PeerTypeProvider.String():
keyKeeper, err = keykeeper.NewProviderKeyKeeper(opts.KeySigner)
if err != nil {
opts.Logger.Error("failed to create provider key keeper", "error", err)
return nil, errors.Join(err, nd.Close())
}
case p2p.PeerTypeBidder.String():
keyKeeper, err = keykeeper.NewBidderKeyKeeper(opts.KeySigner)
if err != nil {
opts.Logger.Error("failed to create bidder key keeper", "error", err)
return nil, errors.Join(err, nd.Close())
}
default:
Expand All @@ -141,6 +145,7 @@ func NewNode(opts *Options) (*Node, error) {
NatAddr: opts.NatAddr,
})
if err != nil {
opts.Logger.Error("failed to create p2p service", "error", err)
return nil, err
}
nd.closers = append(nd.closers, p2pSvc)
Expand All @@ -164,6 +169,7 @@ func NewNode(opts *Options) (*Node, error) {
if opts.PeerType != p2p.PeerTypeBootnode.String() {
lis, err := net.Listen("tcp", opts.RPCAddr)
if err != nil {
opts.Logger.Error("failed to listen", "error", err)
return nil, errors.Join(err, nd.Close())
}

Expand All @@ -174,6 +180,7 @@ func NewNode(opts *Options) (*Node, error) {
opts.TLSPrivateKeyFile,
)
if err != nil {
opts.Logger.Error("failed to load TLS credentials", "error", err)
return nil, fmt.Errorf("unable to load TLS credentials: %w", err)
}
}
Expand All @@ -182,6 +189,7 @@ func NewNode(opts *Options) (*Node, error) {
preconfEncryptor := preconfencryptor.NewEncryptor(keyKeeper)
validator, err := protovalidate.New()
if err != nil {
opts.Logger.Error("failed to create proto validator", "error", err)
return nil, errors.Join(err, nd.Close())
}

Expand Down

0 comments on commit 317c78d

Please sign in to comment.