cleanup and simplify error handling
This commit is contained in:
+5
-9
@@ -87,20 +87,16 @@ func main() {
|
||||
}
|
||||
if !*addTypeFlag {
|
||||
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 {
|
||||
err = fetch.Page(&core.Data, remote, c.Arg(1))
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error adding page: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error adding URL: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
err = core.Data.WriteJSON(dataPath)
|
||||
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)
|
||||
}
|
||||
case "remove":
|
||||
|
||||
Reference in New Issue
Block a user