Skip to content

Commit

Permalink
Dev: add patch for disabling unnecessary fatal errors
Browse files Browse the repository at this point in the history
  • Loading branch information
andriydruk committed Jul 24, 2022
1 parent 94a4592 commit 27421d5
Showing 1 changed file with 26 additions and 0 deletions.
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)

0 comments on commit 27421d5

Please sign in to comment.