From 2d91e932c7dfe76676e6a61c7053334831a8ea08 Mon Sep 17 00:00:00 2001 From: Wojciech Zmuda Date: Wed, 18 Sep 2024 21:30:13 +0200 Subject: [PATCH] main: add missing error handling 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 --- main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.go b/main.go index 2dc2f25..1da568c 100644 --- a/main.go +++ b/main.go @@ -344,8 +344,13 @@ func main() { logging.Logger().Info().Msg("params read successfully") var response *prover.InsertionResponse response, err = ps.ProveInsertion(¶ms) + 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 { @@ -357,8 +362,13 @@ func main() { logging.Logger().Info().Msg("params read successfully") var proof *prover.Proof proof, err = ps.ProveDeletion(¶ms) + 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 {