Add Exception bad XML format

This commit is contained in:
Andros Fenollosa 2022-02-15 15:02:40 +01:00
parent 6a63cd04d4
commit 91b2c85fcc
2 changed files with 18 additions and 11 deletions

View File

@ -1,4 +1,4 @@
(defproject rsspaper "1.2.2" (defproject rsspaper "1.2.3"
:description "RSSpaper" :description "RSSpaper"
:url "https://github.com/tanrax/RSSpaper" :url "https://github.com/tanrax/RSSpaper"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0" :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"

View File

@ -80,8 +80,9 @@
(-> (->
(reduce (reduce
(fn [feeds feed-url] (fn [feeds feed-url]
(try
; Read feed ; Read feed
(let [feed (parse-url feed-url {:insecure? true :throw-exceptions false})] (let [feed (parse-url feed-url {:insecure? true})]
; User feedback ; User feedback
(prn (str "Reading RSS > " feed-url)) (prn (str "Reading RSS > " feed-url))
; Check is not null ; Check is not null
@ -89,7 +90,13 @@
; Add feed and add key feed original ; Add feed and add key feed original
(conj feeds (assoc feed :feed-url feed-url)) (conj feeds (assoc feed :feed-url feed-url))
; Alert fail ; Alert fail
(prn (str "Error with '" feed-url) "'")))) (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)) [] (:feeds config))
zip-feeds-in-articles zip-feeds-in-articles
datetimes-to-unixtime datetimes-to-unixtime