Skip to content

Commit

Permalink
Log expected errors with debug level (cs3org#1324)
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic authored Nov 18, 2020
1 parent 7abafcc commit 0ada3a0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/log-expected-errors-with-debug-level.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Log expected errors with debug level

While trying to download a non existing file and reading a non existing attribute are technically an error they are to be expected and nothing an admin can or even should act upon.

https://github.com/cs3org/reva/pull/1324
4 changes: 2 additions & 2 deletions internal/http/services/dataprovider/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ func (s *svc) doGet(w http.ResponseWriter, r *http.Request) {
rc, err := s.storage.Download(ctx, ref)
if err != nil {
if _, ok := err.(errtypes.IsNotFound); ok {
log.Err(err).Msg("datasvc: file not found")
log.Debug().Err(err).Msg("datasvc: file not found")
w.WriteHeader(http.StatusNotFound)
} else {
log.Err(err).Msg("datasvc: error downloading file")
log.Error().Err(err).Msg("datasvc: error downloading file")
w.WriteHeader(http.StatusInternalServerError)
}
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/fs/ocis/grants.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func extractACEsFromAttrs(ctx context.Context, fsfn string, attrs []string) (ent
var e *ace.ACE
principal := attrs[i][len(grantPrefix):]
if e, err = ace.Unmarshal(principal, value); err != nil {
log.Error().Err(err).Str("principal", principal).Str("attr", attrs[i]).Msg("could unmarshal ace")
log.Error().Err(err).Str("principal", principal).Str("attr", attrs[i]).Msg("could not unmarshal ace")
continue
}
entries = append(entries, e)
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/fs/ocis/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func (t *Tree) Propagate(ctx context.Context, n *Node) (err error) {
switch {
case err != nil:
// missing attribute, or invalid format, overwrite
log.Error().Err(err).
log.Debug().Err(err).
Interface("node", n).
Msg("could not read tmtime attribute, overwriting")
updateSyncTime = true
Expand Down

0 comments on commit 0ada3a0

Please sign in to comment.