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

Removal of tuple return - I/O Kit & SMC return codes #8

Closed
beltex opened this issue Nov 19, 2014 · 3 comments
Closed

Removal of tuple return - I/O Kit & SMC return codes #8

beltex opened this issue Nov 19, 2014 · 3 comments
Labels

Comments

@beltex
Copy link
Owner

beltex commented Nov 19, 2014

... -> (..., IOReturn: kern_return_t, kSMC: UInt8)

Do we really need to return the error codes? On a debug build, they'll be printed out. In release, could you/would you act on those error codes? Probably not. The value returned should indicate if something has gone wrong already, like 0 RPM for a fan speed call.

@beltex
Copy link
Owner Author

beltex commented Feb 7, 2015

In addition to this, another thing to ponder is if to return optional values instead. This would be more Swifty in approach and probably better. For main values (like say fan RPM), nil makes it clear that something has gone wrong, while for error codes, nil would indicate no error (as seen in NSJSONSerialization for example).

@beltex
Copy link
Owner Author

beltex commented Feb 7, 2015

Related: beltex/SystemKit#17

@beltex beltex mentioned this issue Aug 17, 2015
@beltex
Copy link
Owner Author

beltex commented Aug 19, 2015

This has been addressed in #23 with the new error handling in Swift 2.0. See Error Handling section in pull request description.

@beltex beltex closed this as completed Aug 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant