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

Parity: NSCoder miscellanea #2119

Merged
merged 2 commits into from
Apr 17, 2019
Merged

Parity: NSCoder miscellanea #2119

merged 2 commits into from
Apr 17, 2019

Commits on Apr 16, 2019

  1. Parity: NSCoder miscellanea

    - Added missing API: `DecodingFailurePolicy.raiseException`. It is now the default like on Darwin.
    
    - Match Darwin behavior while decoding if you decode without raising exceptions.
    
    - `decodeTopLevel…` variants are noted unavailable on swift-corelibs-foundation, with rationale and replacement directions.
    
    Swift doesn’t have exceptions, and it used to define `.setErrorAndReturn` as the defaults. However, until very recently `failWithError(_:)` was unimplemented and trapped with a fatal error, effectively meaning that all coding failures were behaving as if `.raiseException` was set in a Darwin Swift-only app: by crashing.
    
    Since code written to 4.x-5.0 may be relying on this behavior, we make it explicit and consistent with Darwin: there is now a `.raiseException` constant, it’s the default, and it fails with a fatal error in `failWithError(_:)`. The new secure initializers (at #2102) set `.setErrorAndReturn` just like on Darwin, and thus won’t raise and instead just thrown an error.
    
    Tests will be added.
    millenomi committed Apr 16, 2019
    Configuration menu
    Copy the full SHA
    38f68fe View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    662f0d7 View commit details
    Browse the repository at this point in the history