mirror of
https://code.dumpstack.io/tools/wi.git
synced 2024-11-14 06:19:19 +02:00
Use fatal log instead of panic
This commit is contained in:
parent
9b657de7b9
commit
69d33189ad
|
@ -102,24 +102,22 @@ func Get(db *sql.DB, url string) {
|
||||||
|
|
||||||
utf8, err := charset.NewReader(resp.Body, resp.Header.Get("Content-Type"))
|
utf8, err := charset.NewReader(resp.Body, resp.Header.Get("Content-Type"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Encoding error:", err)
|
log.Fatalln("Encoding error:", err)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(utf8)
|
body, err := ioutil.ReadAll(utf8)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("IO error:", err)
|
log.Fatalln("IO error:", err)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
htmlPage, err := parseLinks(db, body, req)
|
htmlPage, err := parseLinks(db, body, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
log.Fatalln("Parse links error:", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
text, err := html2text.FromString(htmlPage)
|
text, err := html2text.FromString(htmlPage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
log.Fatalln("Html to text error:", err)
|
||||||
}
|
}
|
||||||
text += ""
|
text += ""
|
||||||
|
|
||||||
|
@ -138,7 +136,7 @@ func Link(db *sql.DB, linkID int64, fromHistory bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
log.Fatalln("Get link/history url error:", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
Get(db, url)
|
Get(db, url)
|
||||||
|
@ -147,7 +145,7 @@ func Link(db *sql.DB, linkID int64, fromHistory bool) {
|
||||||
func History(db *sql.DB, argAmount, defaultAmount int64, all bool) {
|
func History(db *sql.DB, argAmount, defaultAmount int64, all bool) {
|
||||||
history, err := storage.GetHistory(db)
|
history, err := storage.GetHistory(db)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
log.Fatalln("Get history error:", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var amount int64
|
var amount int64
|
||||||
|
|
Loading…
Reference in New Issue