Skip to content

Commit 5665e12

Browse files
committed
Don’t fail OSLogScraper if a single crashed request could not be parsed
If we fail to extract the failed request from one crashed sourcekitd request, we should not fail sourcekitd request reduction altogether. Instead, we should just continue searching for the next crashed requested and see if we can reduce that one.
1 parent b3d2df7 commit 5665e12

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sources/Diagnose/OSLogScraper.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,12 @@ struct OSLogScraper {
8282
/// Name is a human readable name that identifies the crash.
8383
func getCrashedRequests() throws -> [(name: String, info: RequestInfo)] {
8484
let crashedRequests = try crashedSourceKitLSPRequests().reversed()
85-
return try crashedRequests.map { ($0.name, try requestInfo(for: $0.logCategory)) }
85+
return crashedRequests.compactMap { (name: String, logCategory: String) -> (name: String, info: RequestInfo)? in
86+
guard let requestInfo = try? requestInfo(for: logCategory) else {
87+
return nil
88+
}
89+
return (name, requestInfo)
90+
}
8691
}
8792
}
8893
#endif

0 commit comments

Comments
 (0)