Skip to content

Commit

Permalink
main: add missing error handling
Browse files Browse the repository at this point in the history
When proving failed, error code was ignored, and null response was
parsed and returned. Catch the error and return early.

Signed-off-by: Wojciech Zmuda <[email protected]>
  • Loading branch information
wzmuda committed Sep 18, 2024
1 parent 2ed03fa commit 2d91e93
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,13 @@ func main() {
logging.Logger().Info().Msg("params read successfully")
var response *prover.InsertionResponse
response, err = ps.ProveInsertion(&params)
if err != nil {
logging.Logger().Error().Msg("insertion prove failed")
return err
}
r, err = json.Marshal(&response)
if err != nil {
logging.Logger().Error().Msg("insertion prove response marshal failed")
return err
}
} else if mode == server.DeletionMode {
Expand All @@ -357,8 +362,13 @@ func main() {
logging.Logger().Info().Msg("params read successfully")
var proof *prover.Proof
proof, err = ps.ProveDeletion(&params)
if err != nil {
logging.Logger().Error().Msg("deletion prove failed")
return err
}
r, err = json.Marshal(&proof)
if err != nil {
logging.Logger().Error().Msg("deletion prove response marshal failed")
return err
}
} else {
Expand Down

0 comments on commit 2d91e93

Please sign in to comment.