Add structured logging and better error handling

This commit is contained in:
SirBlob committed 2026-11-01 13:50:26 -05:00
1 parent db4e3c9611
commit 68c7dd76f2
31 files changed
+640 -109

No files matched your search

+4 -1
View File
@@ -6,6 +6,7 @@ import (
"path/filepath"
"strings"
"ddc/internal/explain"
"ddc/internal/files"
"ddc/internal/libraries"
"ddc/internal/preferences"
@@ -82,6 +83,7 @@ func (manager *Manager) moveToTarget(job *Job) {
}
names, err := topLevelNames(job.directory)
if err == nil {
job.logger().Info("moving to chosen folder", "destination", job.target.displayPath(), "items", len(names))
err = manager.Move(job.id, MoveRequest{
Paths: names,
Destination: job.target.destination,
@@ -90,7 +92,8 @@ func (manager *Manager) moveToTarget(job *Job) {
})
}
if err != nil {
job.setStatus(StatusReady, "Move failed: "+err.Error())
job.logger().Error("automatic move failed", "destination", job.target.displayPath(), "error", err)
job.setStatus(StatusReady, "Move failed: "+explain.Error(err))
}
}