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

[SR-15492] Swift Argument Parser not respecting code and message of CustomNSError #57797

Closed
swift-ci opened this issue Nov 17, 2021 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-15492
Radar None
Original Reporter cbfullerx (JIRA User)
Type Bug
Status Resolved
Resolution Invalid
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 42109291edaee23fe32eda07d3999490

Issue Description:

Test code:

import ArgumentParser
import Foundation

@main
final class Example: ParsableCommand {

    enum MyError: CustomNSError {

        case exampleError

        var errorCode: Int { 23 }
        var errorUserInfo: [String: Any] { [NSLocalizedDescriptionKey: "Hello World"] }
    }

    func run() throws {
        throw MyError.exampleError
    }
}

Expected Output:
"Error: Hello World" with exit status code 23

Actual Output:
"Error: exampleError" with exit status code 0

This worked correctly previously …

Tested Using Swift Argument Parser v0.3.2:
Exit status code: 23
Output: "Error: Hello World"

Tested Using Swift Argument Parser v1.0.2:
Exit status code: 1
Output: "Error: exampleError"

… so this appears to be a regression.

@swift-ci
Copy link
Contributor Author

Comment by Christopher Fuller (JIRA)

Closing as invalid since this has been covered in the Argument Parser repo.

@swift-ci
Copy link
Contributor Author

Comment by Christopher Fuller (JIRA)

Relevant PR … apple/swift-argument-parser#276

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

1 participant