Fix some warnings. (#3416)

This commit is contained in:
Doug
2024-10-16 08:54:34 +01:00
committed by GitHub
parent 236d142583
commit 718774dc36
10 changed files with 48 additions and 43 deletions
@@ -117,14 +117,14 @@ class BugReportService: NSObject, BugReportServiceProtocol {
let (data, response) = try await session.dataWithRetry(for: request, delegate: self)
guard let httpResponse = response as? HTTPURLResponse else {
let errorDescription = String(decoding: data, as: UTF8.self).trimmingCharacters(in: .whitespacesAndNewlines)
let errorDescription = String(data: data, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "Unknown error"
MXLog.error("Failed to submit bug report: \(errorDescription)")
MXLog.error("Response: \(response)")
return .failure(.serverError(response, errorDescription))
}
guard httpResponse.statusCode == 200 else {
let errorDescription = String(decoding: data, as: UTF8.self).trimmingCharacters(in: .whitespacesAndNewlines)
let errorDescription = String(data: data, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "Unknown error"
MXLog.error("Failed to submit bug report: \(errorDescription) (\(httpResponse.statusCode))")
MXLog.error("Response: \(httpResponse)")
return .failure(.httpError(httpResponse, errorDescription))