Browse Source

lib/config: Add context to the home disk out of space error (#5241)

Simon Frei 7 years ago
parent
commit
714a47ffb0
1 changed files with 6 additions and 2 deletions
  1. 6 2
      lib/config/wrapper.go

+ 6 - 2
lib/config/wrapper.go

@@ -7,6 +7,7 @@
 package config
 
 import (
+	"fmt"
 	"os"
 	"path/filepath"
 	"sync/atomic"
@@ -499,8 +500,11 @@ func (w *Wrapper) AddOrUpdatePendingFolder(id, label string, device protocol.Dev
 // CheckHomeFreeSpace returns nil if the home disk has the required amount of
 // free space, or if home disk free space checking is disabled.
 func (w *Wrapper) CheckHomeFreeSpace() error {
-	if usage, err := fs.NewFilesystem(fs.FilesystemTypeBasic, filepath.Dir(w.ConfigPath())).Usage("."); err == nil {
-		return checkFreeSpace(w.Options().MinHomeDiskFree, usage)
+	path := filepath.Dir(w.ConfigPath())
+	if usage, err := fs.NewFilesystem(fs.FilesystemTypeBasic, path).Usage("."); err == nil {
+		if err = checkFreeSpace(w.Options().MinHomeDiskFree, usage); err != nil {
+			return fmt.Errorf("insufficient space on home disk (%v): %v", path, err)
+		}
 	}
 	return nil
 }