Skip to content

Adopt typed throws in FileHandle. - #1997

Open
grynspan wants to merge 5 commits into
mainfrom
jgrynspan/typed-throws-filehandle
Open

grynspan wants to merge 5 commits into
mainfrom
jgrynspan/typed-throws-filehandle

Conversation

@grynspan

Copy link
Copy Markdown
Contributor

This PR adopts typed throws in FileHandle, which almost exclusively throws errors of type CError (representing the same error domain as Foundation's POSIXError) or errors provided by a callback.

We must still use untyped throws in one spot, which I've noted as audited by changing the signature to explicitly throws(any Error). Sum types would help us avoid situations like this one.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

This PR adopts typed throws in `FileHandle`, which almost exclusively throws
errors of type `CError` (representing the same error domain as Foundation's
`POSIXError`) or errors provided by a callback.

We must still use untyped throws in one spot, which I've noted as audited by
changing the signature to explicitly `throws(any Error)`. Sum types would help
us avoid situations like this one.
@grynspan grynspan added this to the Swift 6.5.0 (main) milestone Oct 30, 2026
@grynspan grynspan self-assigned this Oct 30, 2026
@grynspan grynspan added performance 🏎️ Performance issues embedded-swift 📟 Embedded Swift issues typed-throws 🤽 Adoption of, or issues related to, the typed throws language feature labels Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

embedded-swift 📟 Embedded Swift issues performance 🏎️ Performance issues typed-throws 🤽 Adoption of, or issues related to, the typed throws language feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant