cleanup and simplify error handling
This commit is contained in:
+4
-8
@@ -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)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
|
if err != nil {
|
||||||
|
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":
|
||||||
|
|||||||
Reference in New Issue
Block a user