-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for handling client errors on reply-less messages #17
Comments
I agree with the problem. Will leave feedback on the PR in regards to the specific solution. |
Response to https://github.com/trilemma-dev/SecureXPC/pull/18/files#r748837217 Hmmm you're totally right.
I experimented with this idea. One thing to note is that you can't just use a
I think this would be good. The completion handler can be
True. I didn't notice this because I was narrowly interested in seeing the connected/disconnected status of my connection (I built a small little debugging UI in my App using |
Why does the reply type need to conform to Right now the reply handler is
Hmm, not sure we should actually allow it to be |
Although the reply-less
On the contrary, Swift has a whole suite of "escape hatches" ( |
I imagine it'd be a function which "wraps" the existing
Those don't let you ignore the error though, they terminate your process if an error actually occurs. If I understood you correctly passing in |
I'm looking into it. First I was trying to decide if this warrants new route types.
That's pretty much equal to |
Good point, I so rarely use let client = XPCClient.forMachService(named: "com.example.service")
let route = XPCRouteWithoutMessageWithoutReply("configamajig", "discombobulate")
try? client.send(route: route) So with that in mind, sure passing in |
Fixes #17 All `send` and `sendMessage` functions now take in a `XPCResponseHandler` (renamed from `XPCReplyHandler`). For those that require a reply, the response handler is non-optional. For those that can't have a reply, they can optionally provide a `XPCResponseHandler<Void>` which will get called upon successful completion or be provided an `XPCError`. In all cases, none of the functions now `throw` - all errors generated are provided to their handlers (or ignored if no handler is provided). Two existing tests were modified and two new tests have been added. This has been designed in a way which should make it relatively straightforward to address #19.
When there's no "reply" block, there's nowhere to detect errors that were encountered after sending a reply-less message.
The text was updated successfully, but these errors were encountered: