Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
gmgigi96 committed Nov 18, 2022
1 parent 8678c14 commit 2f2cdc8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/http/services/owncloud/ocdav/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ func (s *svc) handleHttpError(w http.ResponseWriter, err error, log *zerolog.Log
switch err.(type) {
case errtypes.NotFound:
http.Error(w, "Resource not found", http.StatusNotFound)
case manager.ErrMaxSize, manager.ErrMaxFileCount:
http.Error(w, err.Error(), http.StatusRequestEntityTooLarge)
default:
http.Error(w, err.Error(), http.StatusInternalServerError)
}
Expand Down Expand Up @@ -215,8 +217,6 @@ func (s *svc) downloadArchive(ctx context.Context, w http.ResponseWriter, token
return
}

w.WriteHeader(http.StatusOK)

if err := archiver.CreateTar(ctx, w); err != nil {
s.handleHttpError(w, err, log)
return
Expand Down

0 comments on commit 2f2cdc8

Please sign in to comment.