1
0

Wrote more detailed error messages.

This commit is contained in:
Alexander Andreev 2022-03-06 21:52:50 +04:00
parent f8dd68d2a2
commit 34d1a0e24b
Signed by: Arav
GPG Key ID: 1327FE8A374CC86F

View File

@ -60,7 +60,7 @@ func main() {
}
if err := substituteUser(config.User); err != nil {
log.Fatalln(err)
log.Fatalf("failed to change user to %s: %s", config.User, err)
}
if *logToStdout {
@ -98,7 +98,7 @@ func main() {
uploadDirNotify := make(chan uint32)
uploadDirSize, err := utils.DirectorySize(config.Uploads.Directory)
if err != nil {
logErr.Fatalln(err)
logErr.Fatalf("failed to get initial size of %s: %s", config.Uploads.Directory, err)
}
watcha.WatchForMask(uploadDirNotify, watcher.CrDelMask)
@ -113,7 +113,7 @@ func main() {
srv.GET("/f/:hash/:name", hand.Download)
if err := srv.Start(config.SplitNetworkAddress()); err != nil {
logErr.Fatalln(err)
logErr.Fatalln("failed to start a server:", err)
}
doneSignal := make(chan os.Signal, 1)
@ -125,14 +125,14 @@ func main() {
select {
case <-doneSignal:
if err := srv.Stop(); err != nil {
logErr.Fatalln(err)
logErr.Fatalln("failed to properly shutdown a server:", err)
}
closeSignal <- true
case <-uploadDirNotify:
sz, err := utils.DirectorySize(config.Uploads.Directory)
if err != nil {
logErr.Println(err)
logErr.Println("failed to get uploads directory size:", err)
}
if sz > 0 {