-
Notifications
You must be signed in to change notification settings - Fork 7
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
Constrain Parsed Error to Swift Error #57
Conversation
Thanks! What do you think of also adding a conformance to extension ParseIssue: LocalizedError {
public var errorDescription: String? {
switch self {
case typeMismatch(let expected, let actual):
return "Type mismatch. Expecting \(expected.rawValue) and got \(actual.primative.rawValue): \(actual.description.prefix(20)"
case noEnumCaseMatch(let value):
return ...
case missingRequiredProperty(let property)
return "Missing required property `\(property)`"
case compactMapValueNil(let value)
return ...
case compositionFailure(let type, let reason, let nestedErrors)
return ...
}
}
}
|
How about this? Conform to I'm not sure about using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
Co-authored-by: Guillaume Sabran <sabranguillaume@gmail.com>
Co-authored-by: Guillaume Sabran <sabranguillaume@gmail.com>
Description
This PR updates the Parsed<Value, Error> enum to constrain the Error generic to conform to Swift.Error. This change ensures semantic clarity, improves type safety, and enables better integration with Swift’s error-handling mechanisms.
Closes #56
Type of Change
Additional Notes
Add any other context or screenshots about the pull request here.
Note: You can add the
auto-format
label to this pull request to enable automatic Swift formatting.