 
 extension Cachable where Self: Codable {
 	public func transform() -> Data {
-		guard let encoded = try? JSONEncoder().encode(self) else {
-			fatalError("Unable to encode object")
+		do {
+			let encoded = try JSONEncoder().encode(self)
+			return encoded
+		} catch let error {
+			fatalError("Unable to encode object: \(error)")
 		}
-		return encoded
 	}
 }

	///
	/// - Parameter fileName: of the cached data stored in the file system
	/// - Returns: the decoded cached data (if any)
	public func load<T: Cachable & Codable>(fileName: String) -> T? {
		guard
			let data = try? Data(contentsOf: destination.appendingPathComponent(fileName, isDirectory: false)),
			let decoded = try? JSONDecoder().decode(T.self, from: data)
			else { return nil }
		return decoded
	}
	
	// MARK: Private
	
	private func persist(data: Data, at url: URL) -> URL? {
		do {
			try data.write(to: url, options: [.atomicWrite])
			return url
		} catch {
			return nil
		}
	}
}

			self.destination = URL(fileURLWithPath: documentFolder).appendingPathComponent(folder, isDirectory: true)
		}
		
		do {
			try FileManager.default.createDirectory(at: self.destination, withIntermediateDirectories: true, attributes: nil)
		} catch let error {
			throw error
		}
	}
	
	// MARK
	
	public func persist(item: Cachable, completion: @escaping (_ url: URL?, _ error: Error?) -> Void) {
		var url: URL?
		var persistError: Error?
		
		// Create an operation to process the request.
		let operation = BlockOperation {
			do {
				url = try self.persist(data: item.transform(), at: self.destination.appendingPathComponent(item.fileName, isDirectory: false))
			} catch let error {
				persistError = error
			}
		}
		
		// Set the operation's completion block to call the request's completion handler.
		operation.completionBlock = {
			completion(url, persistError)
		}
		
		// Add the operation to the queue to start the work.
