From 7e1a5517d014aea96782d6734fb6d3204fecf8c3 Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 8 Jan 2024 22:40:35 +0000 Subject: [PATCH] Add missing break after HTTP errors. Change 'Nothing to integrate' case to 400. --- experimental/gcp-log/function.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/experimental/gcp-log/function.go b/experimental/gcp-log/function.go index cd7dceb..adb8839 100644 --- a/experimental/gcp-log/function.go +++ b/experimental/gcp-log/function.go @@ -311,6 +311,7 @@ func Integrate(w http.ResponseWriter, r *http.Request) { http.Error(w, fmt.Sprintf("Failed to read log checkpoint: %q", err), http.StatusInternalServerError) + return } // Check signatures @@ -319,6 +320,7 @@ func Integrate(w http.ResponseWriter, r *http.Request) { http.Error(w, fmt.Sprintf("Failed to open Checkpoint: %q", err), http.StatusInternalServerError) + return } // Integrate new entries @@ -330,7 +332,8 @@ func Integrate(w http.ResponseWriter, r *http.Request) { return } if newCp == nil { - http.Error(w, "Nothing to integrate", http.StatusInternalServerError) + http.Error(w, "Nothing to integrate", http.StatusBadRequest) + return } err = signAndWrite(ctx, newCp, cpNote, noteSigner, client, d.Origin) @@ -338,6 +341,7 @@ func Integrate(w http.ResponseWriter, r *http.Request) { http.Error(w, fmt.Sprintf("Failed to sign: %q", err), http.StatusInternalServerError) + return } return