Skip to content

Commit 27421d5

Browse files
committed
Dev: add patch for disabling unnecessary fatal errors
1 parent 94a4592 commit 27421d5

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff --git a/Sources/FoundationNetworking/URLSession/NativeProtocol.swift b/Sources/FoundationNetworking/URLSession/NativeProtocol.swift
2+
index 5cf0637e..fdee75ab 100644
3+
--- a/Sources/FoundationNetworking/URLSession/NativeProtocol.swift
4+
+++ b/Sources/FoundationNetworking/URLSession/NativeProtocol.swift
5+
@@ -67,7 +67,10 @@ internal class _NativeProtocol: URLProtocol, _EasyHandleDelegate {
6+
suspend()
7+
} else {
8+
self.internalState = .transferFailed
9+
- guard let error = self.task?.error else { fatalError() }
10+
+ guard let error = self.task?.error else {
11+
+ NSLog("No error")
12+
+ return
13+
+ }
14+
completeTask(withError: error)
15+
}
16+
}
17+
@@ -222,7 +225,8 @@ internal class _NativeProtocol: URLProtocol, _EasyHandleDelegate {
18+
}
19+
20+
guard let response = ts.response else {
21+
- fatalError("Transfer completed, but there's no response.")
22+
+ NSLog("Transfer completed, but there's no response.")
23+
+ return
24+
}
25+
internalState = .transferCompleted(response: response, bodyDataDrain: ts.bodyDataDrain)
26+
let action = completionAction(forCompletedRequest: request, response: response)

0 commit comments

Comments
 (0)