-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev: add patch for disabling unnecessary fatal errors
- Loading branch information
1 parent
94a4592
commit 27421d5
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
...es/release/5.4/swift-corelibs-foundation/0001-unnecessary-fatal-error-in-networking.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
diff --git a/Sources/FoundationNetworking/URLSession/NativeProtocol.swift b/Sources/FoundationNetworking/URLSession/NativeProtocol.swift | ||
index 5cf0637e..fdee75ab 100644 | ||
--- a/Sources/FoundationNetworking/URLSession/NativeProtocol.swift | ||
+++ b/Sources/FoundationNetworking/URLSession/NativeProtocol.swift | ||
@@ -67,7 +67,10 @@ internal class _NativeProtocol: URLProtocol, _EasyHandleDelegate { | ||
suspend() | ||
} else { | ||
self.internalState = .transferFailed | ||
- guard let error = self.task?.error else { fatalError() } | ||
+ guard let error = self.task?.error else { | ||
+ NSLog("No error") | ||
+ return | ||
+ } | ||
completeTask(withError: error) | ||
} | ||
} | ||
@@ -222,7 +225,8 @@ internal class _NativeProtocol: URLProtocol, _EasyHandleDelegate { | ||
} | ||
|
||
guard let response = ts.response else { | ||
- fatalError("Transfer completed, but there's no response.") | ||
+ NSLog("Transfer completed, but there's no response.") | ||
+ return | ||
} | ||
internalState = .transferCompleted(response: response, bodyDataDrain: ts.bodyDataDrain) | ||
let action = completionAction(forCompletedRequest: request, response: response) |