cleanup and simplify error handling

This commit is contained in:
nytpu
2021-03-18 12:05:16 -06:00
parent f05d1e6c2a
commit 794b1fc04f
+5 -9
View File
@@ -87,20 +87,16 @@ func main() {
} }
if !*addTypeFlag { if !*addTypeFlag {
err = fetch.Feed(&core.Data, remote, c.Arg(1)) err = fetch.Feed(&core.Data, remote, c.Arg(1))
if err != nil {
fmt.Fprintf(os.Stderr, "Error adding feed: %v\n", err)
os.Exit(1)
}
} else { } else {
err = fetch.Page(&core.Data, remote, c.Arg(1)) err = fetch.Page(&core.Data, remote, c.Arg(1))
if err != nil { }
fmt.Fprintf(os.Stderr, "Error adding page: %v\n", err) if err != nil {
os.Exit(1) fmt.Fprintf(os.Stderr, "Error adding URL: %v\n", err)
} os.Exit(1)
} }
err = core.Data.WriteJSON(dataPath) err = core.Data.WriteJSON(dataPath)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "Error writing json: %v\n", err) fmt.Fprintf(os.Stderr, "Error saving subscriptions: %v\n", err)
os.Exit(1) os.Exit(1)
} }
case "remove": case "remove":