Skip to content

Commit

Permalink
Add missing break after HTTP errors. Change 'Nothing to integrate' ca…
Browse files Browse the repository at this point in the history
…se to 400.
  • Loading branch information
jiggoha committed Jan 8, 2024
1 parent a78734d commit 7e1a551
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion experimental/gcp-log/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -330,14 +332,16 @@ 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)
if err != nil {
http.Error(w,
fmt.Sprintf("Failed to sign: %q", err),
http.StatusInternalServerError)
return
}

return
Expand Down

0 comments on commit 7e1a551

Please sign in to comment.