Skip to content

Commit

Permalink
noto: Clean up return values from handler
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Richardson <[email protected]>
  • Loading branch information
awrichar committed Aug 19, 2024
1 parent 40be647 commit 3df0d3a
Showing 1 changed file with 10 additions and 27 deletions.
37 changes: 10 additions & 27 deletions domains/noto/internal/noto/noto.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ func (d *Noto) handleMessage(ctx context.Context, message *pb.Message) error {
if err != nil {
return err
}

factoryJSON, err := json.Marshal(d.Factory.ABI)
if err != nil {
return err
Expand All @@ -250,16 +249,12 @@ func (d *Noto) handleMessage(ctx context.Context, message *pb.Message) error {
AbiStateSchemasJson: []string{},
},
}
if err := d.sendReply(ctx, message, response); err != nil {
return err
}
return d.sendReply(ctx, message, response)

case *pb.InitDomainRequest:
log.L(ctx).Infof("Received InitDomainRequest")
response := &pb.InitDomainResponse{}
if err := d.sendReply(ctx, message, response); err != nil {
return err
}
return d.sendReply(ctx, message, response)

case *pb.InitDeployTransactionRequest:
log.L(ctx).Infof("Received InitDeployTransactionRequest")
Expand All @@ -279,9 +274,7 @@ func (d *Noto) handleMessage(ctx context.Context, message *pb.Message) error {
},
},
}
if err := d.sendReply(ctx, message, response); err != nil {
return err
}
return d.sendReply(ctx, message, response)

case *pb.PrepareDeployTransactionRequest:
log.L(ctx).Infof("Received PrepareDeployTransactionRequest")
Expand All @@ -305,19 +298,15 @@ func (d *Noto) handleMessage(ctx context.Context, message *pb.Message) error {
},
SigningAddress: params.Notary,
}
if err := d.sendReply(ctx, message, response); err != nil {
return err
}
return d.sendReply(ctx, message, response)

case *pb.InitTransactionRequest:
log.L(ctx).Infof("Received InitTransactionRequest")

response := &pb.InitTransactionResponse{
RequiredVerifiers: []*pb.ResolveVerifierRequest{},
}
if err := d.sendReply(ctx, message, response); err != nil {
return err
}
return d.sendReply(ctx, message, response)

case *pb.AssembleTransactionRequest:
log.L(ctx).Infof("Received AssembleTransactionRequest")
Expand Down Expand Up @@ -351,19 +340,15 @@ func (d *Noto) handleMessage(ctx context.Context, message *pb.Message) error {
},
},
}
if err := d.sendReply(ctx, message, response); err != nil {
return err
}
return d.sendReply(ctx, message, response)

case *pb.EndorseTransactionRequest:
log.L(ctx).Infof("Received EndorseTransactionRequest")

response := &pb.EndorseTransactionResponse{
EndorsementResult: pb.EndorseTransactionResponse_ENDORSER_SUBMIT,
}
if err := d.sendReply(ctx, message, response); err != nil {
return err
}
return d.sendReply(ctx, message, response)

case *pb.PrepareTransactionRequest:
log.L(ctx).Infof("Received PrepareTransactionRequest")
Expand All @@ -379,16 +364,14 @@ func (d *Noto) handleMessage(ctx context.Context, message *pb.Message) error {
}`,
},
}
if err := d.sendReply(ctx, message, response); err != nil {
return err
}
return d.sendReply(ctx, message, response)

case *pb.DomainAPIError:
log.L(ctx).Errorf("Received error: %s", m.ErrorMessage)
return nil

default:
log.L(ctx).Errorf("Unknown type: %s", reflect.TypeOf(m))
return nil
}

return nil
}

0 comments on commit 3df0d3a

Please sign in to comment.