Add Exception bad XML format
This commit is contained in:
parent
6a63cd04d4
commit
91b2c85fcc
|
@ -1,4 +1,4 @@
|
|||
(defproject rsspaper "1.2.2"
|
||||
(defproject rsspaper "1.2.3"
|
||||
:description "RSSpaper"
|
||||
:url "https://github.com/tanrax/RSSpaper"
|
||||
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
|
||||
|
|
|
@ -80,16 +80,23 @@
|
|||
(->
|
||||
(reduce
|
||||
(fn [feeds feed-url]
|
||||
; Read feed
|
||||
(let [feed (parse-url feed-url {:insecure? true :throw-exceptions false})]
|
||||
; User feedback
|
||||
(prn (str "Reading RSS > " feed-url))
|
||||
; Check is not null
|
||||
(if-not (nil? feed)
|
||||
; Add feed and add key feed original
|
||||
(conj feeds (assoc feed :feed-url feed-url))
|
||||
; Alert fail
|
||||
(prn (str "Error with '" feed-url) "'"))))
|
||||
(try
|
||||
; Read feed
|
||||
(let [feed (parse-url feed-url {:insecure? true})]
|
||||
; User feedback
|
||||
(prn (str "Reading RSS > " feed-url))
|
||||
; Check is not null
|
||||
(if-not (nil? feed)
|
||||
; Add feed and add key feed original
|
||||
(conj feeds (assoc feed :feed-url feed-url))
|
||||
; Alert fail
|
||||
(prn (str "Error with '" feed-url) "'")))
|
||||
(catch clojure.lang.ExceptionInfo e
|
||||
(let [response (ex-data e)
|
||||
{:keys [status headers]} response]
|
||||
(prn (str feed-url " has been ignored because of bad formatting."))
|
||||
;; do anything you want
|
||||
))))
|
||||
[] (:feeds config))
|
||||
zip-feeds-in-articles
|
||||
datetimes-to-unixtime
|
||||
|
|
Loading…
Reference in New Issue