Skip to content
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

Surface specific XPC & login item errors #819

Merged
merged 22 commits into from
Jun 4, 2024
Merged

Conversation

quanganhdo
Copy link
Member

@quanganhdo quanganhdo commented May 14, 2024

Required:

Task/Issue URL: https://app.asana.com/0/72649045549333/1207013105069620/f
iOS PR:duckduckgo/iOS#2872
macOS PR: https://github.com/duckduckgo/macos-browser/pull/2773
What kind of version bump will this require?: Minor

Optional:

Tech Design URL:
CC:

Description:

Steps to test this PR:

  1. See platform-specific PRs

OS Testing:

  • iOS 14
  • iOS 15
  • iOS 16
  • macOS 10.15
  • macOS 11
  • macOS 12

Internal references:

Software Engineering Expectations
Technical Design Template

@samsymons samsymons self-requested a review May 15, 2024 04:24
@quanganhdo quanganhdo marked this pull request as ready for review May 16, 2024 03:29
Copy link
Contributor

@diegoreymendez diegoreymendez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments as I think there's some space for developer quality-of-life improvements.

import Foundation

@objc
final public class KnownFailure: NSObject, Codable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This forces all errors that are "known" to be defined in BSK which seems unnecessarily restrictive.

Why instead not just make the error adhere to Codable and store that in NetworkProtectionKnownFailureStore.

Then the VPN app can decide what errors are worth passing over IPC, but at least we don't have to add errors that are macOS specific to BSK.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why instead not just make the error adhere to Codable and store that in NetworkProtectionKnownFailureStore.

It's tricky as we need a concrete type to decode the error; and that type needs to be passed around in different ways (e.g. as part of XPCClientInterface, distributed notification object).

To keep it simple, I've moved the custom handling code for TunnelError outside of the initializer and instead made it so that an error conforming to InternalErrorWrapping can expose its internal error. That way we can keep specific errors outside of BSK.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood.

That said, I do think that instead of encoding domain, code and localizedDescription, we should turn this into a Codable enum. See this comment for context.

Copy link
Contributor

@diegoreymendez diegoreymendez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added one request for a change.

import Foundation

@objc
final public class KnownFailure: NSObject, Codable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood.

That said, I do think that instead of encoding domain, code and localizedDescription, we should turn this into a Codable enum. See this comment for context.

@quanganhdo quanganhdo merged commit 79fe0c9 into main Jun 4, 2024
9 checks passed
@quanganhdo quanganhdo deleted the anh/netp/error-ui branch June 4, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants