Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

FileDescriptor.open(_:_:options:permissions:retryOnInterrupt:) should print an error message when trapping on unspecified permissions #78

Open
tayloraswift opened this issue Mar 2, 2022 · 1 comment

Comments

@tayloraswift
Copy link

tayloraswift commented Mar 2, 2022

FileDescriptor.open(_:_:options:permissions:retryOnInterrupt:) traps if options.contains(.create) and permissions is nil. since its callers can throw, why not throw an error instead?

alternatively, if this isn’t appropriate for throws, it should be a fatalError instead of a precondition, so users don’t have to hunt through source code to figure out why FileDescriptor is crashing…

@tayloraswift
Copy link
Author

actually come to think of it, this would not be a good use of throws, since it’s a programmer error. still, it would be better to print the message in the crash dump with a fatalError

@tayloraswift tayloraswift changed the title FileDescriptor.open(_:_:options:permissions:retryOnInterrupt:) should throw an error instead of trapping on unspecified permissions FileDescriptor.open(_:_:options:permissions:retryOnInterrupt:) should print an error message when trapping on unspecified permissions Mar 2, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant