File tree Expand file tree Collapse file tree 1 file changed +3
-20
lines changed Expand file tree Collapse file tree 1 file changed +3
-20
lines changed Original file line number Diff line number Diff line change @@ -626,29 +626,12 @@ public final class Connection {
626
626
627
627
// MARK: - Error Handling
628
628
629
- func sync< T> ( _ block: @escaping ( ) throws -> T ) rethrows -> T {
630
- var success : T ?
631
- var failure : Error ?
632
-
633
- let box : ( ) -> Void = {
634
- do {
635
- success = try block ( )
636
- } catch {
637
- failure = error
638
- }
639
- }
640
-
629
+ func sync< T> ( _ block: ( ) throws -> T ) rethrows -> T {
641
630
if DispatchQueue . getSpecific ( key: Connection . queueKey) == queueContext {
642
- box ( )
631
+ return try block ( )
643
632
} else {
644
- queue. sync ( execute: box) // FIXME: rdar://problem/21389236
645
- }
646
-
647
- if let failure = failure {
648
- try { ( ) -> Void in throw failure } ( )
633
+ return try queue. sync ( execute: block)
649
634
}
650
-
651
- return success!
652
635
}
653
636
654
637
@discardableResult func check( _ resultCode: Int32 , statement: Statement ? = nil ) throws -> Int32 {
You can’t perform that action at this time.
0 commit comments