Skip to content

Commit 83942cb

Browse files
committed
fix: catch errors in booster run
1 parent a1d8c74 commit 83942cb

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

cmd/booster-http/run.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ var runCmd = &cli.Command{
8787
// Connect to the full node API
8888
fnApiInfo := cctx.String("api-fullnode")
8989
fullnodeApi, ncloser, err := getFullNodeApi(ctx, fnApiInfo)
90+
if err != nil {
91+
return fmt.Errorf("getting full node API: %w", err)
92+
}
9093
defer ncloser()
9194

9295
// Connect to the sealing API
@@ -96,9 +99,15 @@ var runCmd = &cli.Command{
9699
return fmt.Errorf("parsing sealing API endpoint: %w", err)
97100
}
98101
sealingService, sealerCloser, err := getMinerApi(ctx, sealingApiInfo)
102+
if err != nil {
103+
return fmt.Errorf("getting miner API: %w", err)
104+
}
99105
defer sealerCloser()
100106

101107
maddr, err := sealingService.ActorAddress(ctx)
108+
if err != nil {
109+
return fmt.Errorf("getting miner actor address: %w", err)
110+
}
102111
log.Infof("Miner address: %s", maddr)
103112

104113
// Use an in-memory repo because we don't need any functions

cmd/booster-http/server.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (s *HttpServer) pieceBasePath() string {
4949
return s.path + "/piece/"
5050
}
5151

52-
func (s *HttpServer) Start(ctx context.Context) error {
52+
func (s *HttpServer) Start(ctx context.Context) {
5353
s.ctx, s.cancel = context.WithCancel(ctx)
5454

5555
listenAddr := fmt.Sprintf(":%d", s.port)
@@ -70,8 +70,6 @@ func (s *HttpServer) Start(ctx context.Context) error {
7070
log.Fatalf("http.ListenAndServe(): %v", err)
7171
}
7272
}()
73-
74-
return nil
7573
}
7674

7775
func (s *HttpServer) Stop() error {

0 commit comments

Comments
 (0)