Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Conrad Kramer <[email protected]>
  • Loading branch information
JettChenT and conradev authored Oct 7, 2023
1 parent 01960af commit 19e0fad
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions Apple/NetworkExtension/BurrowIpc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,9 @@ final class BurrowIpc {
}

func receive_raw() async throws -> Data {
try await withCheckedThrowingContinuation { continuation in
connection.receiveMessage { completeContent, _, _, error in
self.logger.info("Received raw message response")
if let completeContent = completeContent {
continuation.resume(returning: completeContent)
} else if let error = error {
continuation.resume(throwing: error)
}
}
}
let (completeContent, _, _) = try await connection.receiveMessage()
self.logger.info("Received raw message response")
return completeContent
}

func request<U: Decodable>(_ request: Request, type: U.Type) async throws -> U {
Expand All @@ -141,12 +134,6 @@ final class BurrowIpc {
}

func parse_response<U: Decodable>(_ response: Data) throws -> U {
let decoder = JSONDecoder()
do {
let res = try decoder.decode(U.self, from: response)
return res
} catch {
throw error
}
try JSONDecoder().decode(U.self, from: response)
}
}

0 comments on commit 19e0fad

Please sign in to comment.