additional logging of errors for debugging purposes

This commit is contained in:
Baipyrus 2024-11-01 16:38:29 +01:00
parent 4778d287fc
commit d9df5cad1e

View File

@ -5,6 +5,7 @@ package proxy
import ( import (
"errors" "errors"
"fmt" "fmt"
"log"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
@ -33,9 +34,11 @@ func Debug(cfgPath string) {
fmt.Printf("\nConfig:\n") fmt.Printf("\nConfig:\n")
fmt.Printf("%s\n\n", path) fmt.Printf("%s\n\n", path)
proxy, _ := ReadSystemProxy() proxy, err := ReadSystemProxy()
proxyServer := proxy.Server proxyServer := proxy.Server
if proxyServer == "" { if err != nil {
log.Fatal(err)
} else if proxyServer == "" {
proxyServer = "[N/A]" proxyServer = "[N/A]"
} }
@ -43,7 +46,11 @@ func Debug(cfgPath string) {
fmt.Printf("Enabled: %t\n", proxy.Enabled) fmt.Printf("Enabled: %t\n", proxy.Enabled)
fmt.Printf("Server: %s\n\n", proxyServer) fmt.Printf("Server: %s\n\n", proxyServer)
configs, _ := util.ReadConfigs(cfgPath) configs, err := util.ReadConfigs(cfgPath)
if err != nil {
log.Fatal(err)
}
for _, config := range configs { for _, config := range configs {
configCmd := config.Name configCmd := config.Name
// Use command instead of name, if given // Use command instead of name, if given