Import System package when available (#34)
* Import System package when available * Add isResourceTemporarilyUnavailable helper method to reduce number of imports of System / SystemPackage
This commit is contained in:
parent
97b756c0f4
commit
d55140bc46
1 changed files with 42 additions and 9 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import Logging
|
||||
import SystemPackage
|
||||
|
||||
import struct Foundation.Data
|
||||
import struct Foundation.Date
|
||||
|
|
@ -180,7 +179,7 @@ public actor Client {
|
|||
"Unexpected message received by client", metadata: metadata)
|
||||
}
|
||||
}
|
||||
} catch let error as Errno where error == .resourceTemporarilyUnavailable {
|
||||
} catch let error where Error.isResourceTemporarilyUnavailable(error) {
|
||||
try? await Task.sleep(nanoseconds: 10_000_000) // 10ms
|
||||
continue
|
||||
} catch {
|
||||
|
|
|
|||
Loading…
Reference in a new issue