Skip to content

Commit

Permalink
Merge pull request #49 from readdle/fix/unnecessary-fatal-errors
Browse files Browse the repository at this point in the history
Disable unnecessary fatal errors
  • Loading branch information
andriydruk authored Jul 26, 2022
2 parents 94a4592 + 27421d5 commit fe31316
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 fe31316

Please sign in to comment.