Don't explicitly name error variables

Following the resolution of #1512, start using the implicit `error`
variable inside `catch` blocks instead of explicitly declaring `e`
everywhere.
This commit is contained in:
Tim Ekl 2020-01-02 13:31:06 -08:00
parent 5ac18b14a7
commit 44e920b18b
6 changed files with 76 additions and 76 deletions

View File

@ -81,8 +81,8 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
let statusCount = try result.get()
XCTAssertEqual(statusCount, 0)
selectPendingCountExpectation.fulfill()
} catch let e {
XCTFail("Error unwrapping database result: \(e)")
} catch {
XCTFail("Error unwrapping database result: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -124,8 +124,8 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
let statusCount = try result.get()
XCTAssertEqual(statusCount, statuses.count)
selectPendingCountExpectation.fulfill()
} catch let e {
XCTFail("Error unwrapping database result: \(e)")
} catch {
XCTFail("Error unwrapping database result: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -167,8 +167,8 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
let statusCount = try result.get()
XCTAssertEqual(statusCount, 0)
selectPendingCountExpectation.fulfill()
} catch let e {
XCTFail("Error unwrapping database result: \(e)")
} catch {
XCTFail("Error unwrapping database result: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -210,8 +210,8 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
let statusCount = try result.get()
XCTAssertEqual(statusCount, statuses.count)
selectPendingCountExpectation.fulfill()
} catch let e {
XCTFail("Error unwrapping database result: \(e)")
} catch {
XCTFail("Error unwrapping database result: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -253,8 +253,8 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
let statusCount = try result.get()
XCTAssertEqual(statusCount, 0)
selectPendingCountExpectation.fulfill()
} catch let e {
XCTFail("Error unwrapping database result: \(e)")
} catch {
XCTFail("Error unwrapping database result: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -296,8 +296,8 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
let statusCount = try result.get()
XCTAssertEqual(statusCount, statuses.count)
selectPendingCountExpectation.fulfill()
} catch let e {
XCTFail("Error unwrapping database result: \(e)")
} catch {
XCTFail("Error unwrapping database result: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -339,8 +339,8 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
let statusCount = try result.get()
XCTAssertEqual(statusCount, 0)
selectPendingCountExpectation.fulfill()
} catch let e {
XCTFail("Error unwrapping database result: \(e)")
} catch {
XCTFail("Error unwrapping database result: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -382,8 +382,8 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
let expectedCount = try result.get()
XCTAssertEqual(expectedCount, statuses.count)
selectPendingCountExpectation.fulfill()
} catch let e {
XCTFail("Error unwrapping database result: \(e)")
} catch {
XCTFail("Error unwrapping database result: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -442,8 +442,8 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
let statusCount = try result.get()
XCTAssertEqual(statusCount, 0)
selectPendingCountExpectation.fulfill()
} catch let e {
XCTFail("Error unwrapping database result: \(e)")
} catch {
XCTFail("Error unwrapping database result: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -503,8 +503,8 @@ class FeedlySendArticleStatusesOperationTests: XCTestCase {
let statusCount = try result.get()
XCTAssertEqual(statusCount, statuses.count)
selectPendingCountExpectation.fulfill()
} catch let e {
XCTFail("Error unwrapping database result: \(e)")
} catch {
XCTFail("Error unwrapping database result: \(error)")
}
}
waitForExpectations(timeout: 2)

View File

@ -55,8 +55,8 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
XCTAssertTrue(accountArticlesIDs.isEmpty)
XCTAssertEqual(accountArticlesIDs, testIds)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking articles IDs: \(e)")
} catch {
XCTFail("Error checking articles IDs: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -83,8 +83,8 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
let accountArticlesIDs = try accountArticlesIDsResult.get()
XCTAssertEqual(accountArticlesIDs.count, testIds.count)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking articles IDs: \(e)")
} catch {
XCTFail("Error checking articles IDs: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -111,8 +111,8 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
let accountArticlesIDs = try accountArticlesIDsResult.get()
XCTAssertEqual(accountArticlesIDs.count, testIds.count)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking articles IDs: \(e)")
} catch {
XCTFail("Error checking articles IDs: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -154,8 +154,8 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
let remainingAccountArticlesIDs = try remainingAccountArticlesIDsResult.get()
XCTAssertEqual(remainingAccountArticlesIDs, remainingStarredIds)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking articles IDs: \(e)")
} catch {
XCTFail("Error checking articles IDs: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -197,8 +197,8 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
let remainingAccountArticlesIDs = try remainingAccountArticlesIDsResult.get()
XCTAssertEqual(remainingAccountArticlesIDs, remainingStarredIds)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking articles IDs: \(e)")
} catch {
XCTFail("Error checking articles IDs: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -258,8 +258,8 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
XCTAssertEqual(idsOfStarredArticles, remainingStarredIds)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking articles IDs: \(e)")
} catch {
XCTFail("Error checking articles IDs: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -317,8 +317,8 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
XCTAssertEqual(idsOfStarredArticles, remainingStarredIds)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking articles IDs: \(e)")
} catch {
XCTFail("Error checking articles IDs: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -370,8 +370,8 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
XCTAssertEqual(idsOfStarredArticles, remainingStarredIds)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking articles IDs: \(e)")
} catch {
XCTFail("Error checking articles IDs: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -422,8 +422,8 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
XCTAssertEqual(idsOfStarredArticles, remainingStarredIds)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking articles IDs: \(e)")
} catch {
XCTFail("Error checking articles IDs: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -480,8 +480,8 @@ class FeedlySetStarredArticlesOperationTests: XCTestCase {
XCTAssertEqual(idsOfStarredArticles, someRemainingStarredIdsOfIngestedArticles)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking articles IDs: \(e)")
} catch {
XCTFail("Error checking articles IDs: \(error)")
}
}
waitForExpectations(timeout: 2)

View File

@ -55,8 +55,8 @@ class FeedlySetUnreadArticlesOperationTests: XCTestCase {
XCTAssertTrue(accountArticlesIDs.isEmpty)
XCTAssertEqual(accountArticlesIDs.count, testIds.count)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking account articles IDs result: \(e)")
} catch {
XCTFail("Error checking account articles IDs result: \(error)")
}
}
@ -84,8 +84,8 @@ class FeedlySetUnreadArticlesOperationTests: XCTestCase {
let accountArticlesIDs = try accountArticlesIDsResult.get()
XCTAssertEqual(accountArticlesIDs.count, testIds.count)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking account articles IDs result: \(e)")
} catch {
XCTFail("Error checking account articles IDs result: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -112,8 +112,8 @@ class FeedlySetUnreadArticlesOperationTests: XCTestCase {
let accountArticlesIDs = try accountArticlesIDsResult.get()
XCTAssertEqual(accountArticlesIDs.count, testIds.count)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking account articles IDs result: \(e)")
} catch {
XCTFail("Error checking account articles IDs result: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -155,8 +155,8 @@ class FeedlySetUnreadArticlesOperationTests: XCTestCase {
let remainingAccountArticlesIDs = try remainingAccountArticlesIDsResult.get()
XCTAssertEqual(remainingAccountArticlesIDs, remainingUnreadIds)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking account articles IDs result: \(e)")
} catch {
XCTFail("Error checking account articles IDs result: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -198,8 +198,8 @@ class FeedlySetUnreadArticlesOperationTests: XCTestCase {
let remainingAccountArticlesIDs = try remainingAccountArticlesIDsResult.get()
XCTAssertEqual(remainingAccountArticlesIDs, remainingUnreadIds)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking account articles IDs result: \(e)")
} catch {
XCTFail("Error checking account articles IDs result: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -258,8 +258,8 @@ class FeedlySetUnreadArticlesOperationTests: XCTestCase {
XCTAssertEqual(idsOfUnreadArticles, remainingUnreadIds)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking account articles IDs result: \(e)")
} catch {
XCTFail("Error checking account articles IDs result: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -317,8 +317,8 @@ class FeedlySetUnreadArticlesOperationTests: XCTestCase {
XCTAssertEqual(idsOfUnreadArticles, remainingUnreadIds)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking account articles IDs result: \(e)")
} catch {
XCTFail("Error checking account articles IDs result: \(error)")
}
}
}
@ -369,8 +369,8 @@ class FeedlySetUnreadArticlesOperationTests: XCTestCase {
XCTAssertEqual(idsOfUnreadArticles, remainingUnreadIds)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking account articles IDs result: \(e)")
} catch {
XCTFail("Error checking account articles IDs result: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -421,8 +421,8 @@ class FeedlySetUnreadArticlesOperationTests: XCTestCase {
XCTAssertEqual(idsOfUnreadArticles, remainingUnreadIds)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking account articles IDs result: \(e)")
} catch {
XCTFail("Error checking account articles IDs result: \(error)")
}
}
}
@ -477,8 +477,8 @@ class FeedlySetUnreadArticlesOperationTests: XCTestCase {
XCTAssertEqual(idsOfUnreadArticles, someRemainingUnreadIdsOfIngestedArticles)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking account articles IDs result: \(e)")
} catch {
XCTFail("Error checking account articles IDs result: \(error)")
}
}
}

View File

@ -73,8 +73,8 @@ class FeedlySyncStarredArticlesOperationTests: XCTestCase {
XCTAssertEqual(expectedArticles, starredArticles)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking starred article IDs: \(e)")
} catch {
XCTFail("Error checking starred article IDs: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -114,8 +114,8 @@ class FeedlySyncStarredArticlesOperationTests: XCTestCase {
let starredArticleIds = try starredArticleIdsResult.get()
XCTAssertTrue(starredArticleIds.isEmpty)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking starred article IDs: \(e)")
} catch {
XCTFail("Error checking starred article IDs: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -180,8 +180,8 @@ class FeedlySyncStarredArticlesOperationTests: XCTestCase {
XCTAssertEqual(expectedArticles, starredArticles)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking starred article IDs: \(e)")
} catch {
XCTFail("Error checking starred article IDs: \(error)")
}
}
waitForExpectations(timeout: 2)

View File

@ -62,8 +62,8 @@ class FeedlySyncUnreadStatusesOperationTests: XCTestCase {
let missingIds = expectedArticleIds.subtracting(unreadArticleIds)
XCTAssertTrue(missingIds.isEmpty, "These article ids were not marked as unread.")
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking unread article IDs: \(e)")
} catch {
XCTFail("Error checking unread article IDs: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -103,8 +103,8 @@ class FeedlySyncUnreadStatusesOperationTests: XCTestCase {
let unreadArticleIds = try unreadArticleIdsResult.get()
XCTAssertTrue(unreadArticleIds.isEmpty)
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking unread article IDs: \(e)")
} catch {
XCTFail("Error checking unread article IDs: \(error)")
}
}
waitForExpectations(timeout: 2)
@ -158,8 +158,8 @@ class FeedlySyncUnreadStatusesOperationTests: XCTestCase {
let missingIds = expectedArticleIds.subtracting(unreadArticleIds)
XCTAssertTrue(missingIds.isEmpty, "These article ids were not marked as unread.")
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error checking unread article IDs: \(e)")
} catch {
XCTFail("Error checking unread article IDs: \(error)")
}
}
waitForExpectations(timeout: 2)

View File

@ -228,8 +228,8 @@ class FeedlyTestSupport {
// make sure that these ids are marked as unread (a subset of the total).
XCTAssertTrue(ids.isSubset(of: articleIds), "Some articles in `ids` are not marked as unread.")
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error unwrapping article IDs: \(e)")
} catch {
XCTFail("Error unwrapping article IDs: \(error)")
}
}
testCase.wait(for: [fetchIdsExpectation], timeout: 2)
@ -252,8 +252,8 @@ class FeedlyTestSupport {
// make sure that these articles are marked as starred (a subset of the total).
XCTAssertTrue(ids.isSubset(of: articleIds), "Some articles in `ids` are not marked as starred.")
fetchIdsExpectation.fulfill()
} catch let e {
XCTFail("Error unwrapping article IDs: \(e)")
} catch {
XCTFail("Error unwrapping article IDs: \(error)")
}
}
testCase.wait(for: [fetchIdsExpectation], timeout: 2)