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

let archive=try Archive... .update results in "Errors thrown from here are not handled" #349

Open
thethinkingman opened this issue Jan 9, 2025 · 0 comments

Comments

@thethinkingman
Copy link

Summary

Using the example syntax found in the Readme when defining archive it results in the following error:

Errors thrown from here are not handled

Steps to Reproduce

let archive = try Archive(url: archiveURL, accessMode: .update)

Expected Results

No error

Actual Results

Error

What does work

When experimenting with this I referred to ZIPFoundationModerns implementation.

In Archive.swift if I change:

public init(url: URL, accessMode mode: AccessMode, pathEncoding: String.Encoding? = nil) throws {

to

public init?(url: URL, accessMode mode: AccessMode, pathEncoding: String.Encoding? = nil) throws {

I can then use:

guard let archive = try? Archive(url: archiveURL, accessMode: .update) else {
	return
}

Without error

Note:

I am no expert in Swift and I don't know the consequences of this change but I am just informing you that that works - for me.

I noticed that the current Archive INIT does not actually include any throws within the function itself... so I am not sure hoiw it would return nil - as the documentation states.

Once again, when referring to the ZIPFoundationModern code it includes the following in the INIT:

guard let config = Archive.makeBackingConfiguration(for: url, mode: mode) else {
            return nil
 }
``


Also.... just to be a pain in the neck... the Archive.swift source code documentation has not been updated to reflect the latest code changes - you probably already know this. This is not important to me but is just an observation.
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

No branches or pull requests

1 participant