aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Rutger Broekhoff2024-01-02 01:22:19 +0100
committerLibravatar Rutger Broekhoff2024-01-02 01:22:19 +0100
commite0c72c187d39ed7caa0f45ad4935513d435925ed (patch)
treecd9471311d43bf9142f6033417608cc80e24b45b
parent8733aada5526ffae240865b97f83c752cb896a85 (diff)
downloadgitolfs3-e0c72c187d39ed7caa0f45ad4935513d435925ed.tar.gz
gitolfs3-e0c72c187d39ed7caa0f45ad4935513d435925ed.zip
Try generating more descriptive errors
-rw-r--r--cmd/git-lfs-server/main.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/cmd/git-lfs-server/main.go b/cmd/git-lfs-server/main.go
index 3bb1173..0379117 100644
--- a/cmd/git-lfs-server/main.go
+++ b/cmd/git-lfs-server/main.go
@@ -372,7 +372,16 @@ func (h *handler) handlePutObject(w http.ResponseWriter, r *http.Request, repo,
372 SendContentMd5: true, 372 SendContentMd5: true,
373 }) 373 })
374 if err != nil { 374 if err != nil {
375 makeRespError(ctx, w, "Failed to upload object", http.StatusInternalServerError) 375 if errors.Is(err, errBadSum) {
376 makeRespError(ctx, w, "Bad checksum (OID does not match contents)", http.StatusBadRequest)
377 } else if errors.Is(err, errTooSmall) {
378 makeRespError(ctx, w, "Uploaded object smaller than expected", http.StatusBadRequest)
379 } else if errors.Is(err, errTooBig) {
380 makeRespError(ctx, w, "Uploaded object bigger than expected", http.StatusBadRequest)
381 } else {
382 reqlog(ctx, "Failed to upload object: %s", err)
383 makeRespError(ctx, w, "Failed to upload object", http.StatusInternalServerError)
384 }
376 return 385 return
377 } 386 }
378} 387}