Skip to content

Commit

Permalink
chore: add marshall error
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Amoyel authored and aamoyel committed Sep 13, 2023
1 parent ac8e723 commit a2ac57d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http"
"os"

"github.com/aamoyel/kapilogin/cmd/server/pkg/clusters"
cluster "github.com/aamoyel/kapilogin/cmd/server/pkg/clusters"
)

func main() {
Expand All @@ -29,7 +29,11 @@ func ClusterHandler(w http.ResponseWriter, r *http.Request) {
if err != nil {
w.WriteHeader(500)
}
j, _ := json.Marshal(cl)
j, err := json.Marshal(cl)
if err != nil {
slog.Error("request marshaling failed: %+v", err)
w.WriteHeader(500)
}
w.Write(j)
default:
w.WriteHeader(http.StatusMethodNotAllowed)
Expand Down

0 comments on commit a2ac57d

Please sign in to comment.