Skip to content

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

Description

@thethinkingman

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.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions