Handle unhandled error; remove error handling in server-only function (error would never become visible to user)

This commit is contained in:
2025-06-01 12:35:07 -04:00
parent 4dab9f2c93
commit 2e3be57e3e
3 changed files with 8 additions and 13 deletions
+3 -11
View File
@@ -1,7 +1,6 @@
package syncserver
import (
"errors"
"fmt"
"os"
"strings"
@@ -14,16 +13,10 @@ import (
// GetRemoteDataFromServer prints to stdout the remote entries, mod times, folders, and deletions.
// Lists in output are separated by FSSpace.
// Output is meant to be captured over SSH for interpretation by the client.
func GetRemoteDataFromServer(clientDeviceID string) error {
entryList, dirList, err := synccommon.WalkEntryDir()
if err != nil {
return errors.New("unable to walk entry directory: " + err.Error())
}
func GetRemoteDataFromServer(clientDeviceID string) {
entryList, dirList, _ := synccommon.WalkEntryDir()
modList := synccommon.GetModTimes(entryList)
deletionsList, err := os.ReadDir(global.ConfigDir + global.PathSeparator + "deletions")
if err != nil {
return errors.New("unable to read deletions directory: " + err.Error())
}
deletionsList, _ := os.ReadDir(global.ConfigDir + global.PathSeparator + "deletions")
// print the current UNIX timestamp to stdout
fmt.Print(time.Now().Unix())
@@ -60,5 +53,4 @@ func GetRemoteDataFromServer(clientDeviceID string) error {
_ = os.Remove(global.ConfigDir + global.PathSeparator + "deletions" + global.PathSeparator + deletion.Name()) // error ignored; function not run from a user-facing argument and thus the error would not be visible
}
}
return nil
}