Improved bug report error handling (#1018)

* Improve rageshake error handling.

* Add a max file size and exclude older files one the limit is hit.

* Zip log files as smaller chunks.
This commit is contained in:
Doug
2023-06-06 09:24:01 +01:00
committed by GitHub
parent 4e926c3334
commit ea4aa943e0
11 changed files with 279 additions and 100 deletions
@@ -31,6 +31,23 @@ struct SubmitBugReportResponse: Decodable {
var reportUrl: String
}
enum BugReportServiceError: LocalizedError {
case uploadFailure(Error)
case serverError(URLResponse, String)
case httpError(HTTPURLResponse, String)
var errorDescription: String? {
switch self {
case .uploadFailure(let error):
return error.localizedDescription
case .serverError(_, let errorDescription):
return errorDescription
case .httpError(_, let errorDescription):
return errorDescription
}
}
}
// sourcery: AutoMockable
protocol BugReportServiceProtocol {
var isRunning: Bool { get }
@@ -46,5 +63,5 @@ protocol BugReportServiceProtocol {
func crash()
func submitBugReport(_ bugReport: BugReport,
progressListener: ProgressListener?) async throws -> SubmitBugReportResponse
progressListener: ProgressListener?) async -> Result<SubmitBugReportResponse, BugReportServiceError>
}