From cd68febd882870af9db69a46b56604dcc9485e83 Mon Sep 17 00:00:00 2001 From: relikd Date: Sun, 28 Jul 2019 22:38:52 +0200 Subject: [PATCH] Show document URI for any RSXML error --- CHANGELOG.md | 1 + Cartfile.resolved | 2 +- baRSS/Helper/FeedDownload.m | 6 +++--- baRSS/Preferences/Feeds Tab/OpmlFile.m | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c0540e..352c827 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project does NOT adhere to [Semantic Versioning](https://semver.org/spe - Settings, Feeds: Actions 'delete' and 'edit' use clicked items instead of selected items - Comparison of existing articles with nonexistent guid and link - Don't mark articles read if opening URLs failed +- If an error occurs, show document URL (path to file or web url) ### Changed - Interface builder files replaced with code equivalent diff --git a/Cartfile.resolved b/Cartfile.resolved index f573e52..ce92320 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1 +1 @@ -github "relikd/RSXML" "401f470ab00ab656843162e002e111331b001824" +github "relikd/RSXML" "d7b51de438dc575fddf2b89d93a2647024396b17" diff --git a/baRSS/Helper/FeedDownload.m b/baRSS/Helper/FeedDownload.m index 6951717..e8e6fab 100644 --- a/baRSS/Helper/FeedDownload.m +++ b/baRSS/Helper/FeedDownload.m @@ -245,7 +245,7 @@ static BOOL _nextUpdateIsForced = NO; [self asyncRequest:request block:^(NSData * _Nullable data, NSError * _Nullable error, NSHTTPURLResponse *response) { RSParsedFeed *result = nil; if (data) { // data = nil if (error || 304) - RSXMLData *xml = [[RSXMLData alloc] initWithData:data urlString:response.URL.absoluteString]; + RSXMLData *xml = [[RSXMLData alloc] initWithData:data url:response.URL]; if (xmlBlock && xmlBlock(xml, &error)) { return; } @@ -279,7 +279,7 @@ static BOOL _nextUpdateIsForced = NO; if (*err) return NO; if (!parsedMeta || parsedMeta.feedLinks.count == 0) { - *err = RSXMLMakeErrorWrongParser(RSXMLErrorExpectingFeed, RSXMLErrorExpectingHTML); + *err = RSXMLMakeErrorWrongParser(RSXMLErrorExpectingFeed, RSXMLErrorExpectingHTML, xml.url); return NO; } __block NSString *chosenURL = nil; @@ -451,7 +451,7 @@ static BOOL _nextUpdateIsForced = NO; [self asyncRequest:[self newRequestURL:hostURL] block:^(NSData * _Nullable htmlData, NSError * _Nullable error, NSHTTPURLResponse *response) { if (htmlData) { // TODO: use session delegate to stop downloading after - RSXMLData *xml = [[RSXMLData alloc] initWithData:htmlData urlString:hostURL]; + RSXMLData *xml = [[RSXMLData alloc] initWithData:htmlData url:response.URL]; RSHTMLMetadataParser *parser = [RSHTMLMetadataParser parserWithXMLData:xml]; RSHTMLMetadata *meta = [parser parseSync:&error]; if (error) meta = nil; diff --git a/baRSS/Preferences/Feeds Tab/OpmlFile.m b/baRSS/Preferences/Feeds Tab/OpmlFile.m index 9609b49..d2add32 100644 --- a/baRSS/Preferences/Feeds Tab/OpmlFile.m +++ b/baRSS/Preferences/Feeds Tab/OpmlFile.m @@ -97,7 +97,7 @@ NS_INLINE NSInteger RadioGroupSelection(NSView *view) { if (finally) dispatch_group_enter(group); NSData *data = [NSData dataWithContentsOfURL:url]; - RSXMLData *xml = [[RSXMLData alloc] initWithData:data urlString:@"opml-file-import"]; + RSXMLData *xml = [[RSXMLData alloc] initWithData:data url:url]; RSOPMLParser *parser = [RSOPMLParser parserWithXMLData:xml]; [parser parseAsync:^(RSOPMLItem * _Nullable doc, NSError * _Nullable error) { if (error) {