 			return
 		}
 		
+		if let remaining = rateLimitRemaining, let reset = rateLimitReset, remaining < 1 && reset > Date() {
+			completion(.failure(RedditFeedProviderError.rateLimitExceeded))
+			return
+		}
+		
 		let url = "\(Self.apiBase)\(api)"
 
 		var expandedParameters = parameters

			switch result {
			case .success(let response):
				
				let jsonString = String(data: response.data, encoding: .utf8)
				let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.appendingPathComponent("reddit.json")
				print("******** writing to: \(url.path)")
				try? jsonString?.write(toFile: url.path, atomically: true, encoding: .utf8)

				let decoder = JSONDecoder()
				

import RSWeb

public enum RedditFeedProviderError: LocalizedError {
	case rateLimitExceeded
	case unknown
	
	public var localizedDescription: String {
		switch self {
		case .rateLimitExceeded:
			return NSLocalizedString("Reddit API rate limit has been exceeded.  Please wait a short time and try again.", comment: "Rate Limit")
		case .unknown:
			return NSLocalizedString("A Reddit Feed Provider error has occurred.", comment: "Unknown error")
		}
