Skip to content

Commit

Permalink
Delete CachedAsyncImageConfiguration.
Browse files Browse the repository at this point in the history
  • Loading branch information
bullinnyc committed Oct 24, 2023
1 parent d83921a commit c5cd068
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 65 deletions.

This file was deleted.

22 changes: 3 additions & 19 deletions Sources/CachedAsyncImage/Services/NetworkManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ enum NetworkError: LocalizedError {
case transportError(Error)

// Received an bad response, e.g. non HTTP result.
case badResponse(String = "Bad response.")
case badResponse(String)

var rawValue: String {
switch self {
Expand Down Expand Up @@ -71,24 +71,8 @@ final class NetworkManager: NetworkManagerProtocol {
.mapError { NetworkError.transportError($0) }
// Handle all other errors.
.tryMap { element in
guard let httpResponse = element
.response as? HTTPURLResponse else {
throw NetworkError.badResponse()
}

#if DEBUG
if CachedAsyncImageConfiguration.shared.loggerLevel == .max {
let message = """
**** CachedAsyncImage response.
Status code: \(httpResponse.statusCode),
from: \(httpResponse.url?.absoluteString ?? "")
"""

print(message.replacingOccurrences(of: "\n", with: " "))
}
#endif

guard (200...299).contains(httpResponse.statusCode) else {
if let httpResponse = element.response as? HTTPURLResponse,
!(200...299).contains(httpResponse.statusCode) {
throw NetworkError.badResponse(
"Bad response. Status code: \(httpResponse.statusCode)"
)
Expand Down

0 comments on commit c5cd068

Please sign in to comment.