libuv: Expose uv_translate_sys_error?
It would be nice if it were possible for user code which runs posix syscalls to return uv_err_t. However, that’s not the case, because uv_translate_sys_error, despite its singly-underscored name, is not exposed publicly. (This also makes it difficult to translate the error into a string like ‘ENOENT’; you can use strerror but that just provides the long English string.)
I realize that the function is Unix-specific and would require some sort of Windows stub (or for users to #ifdef _WIN32, but it still seems useful.
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 21 (17 by maintainers)
Commits related to this issue
- win: add uv_translate_win32_error Functionality from existing private uv_translate_sys_error was requested to be exposed, so we add uv_translate_win32_error to do just that. Fixes #79 — committed to plafer/libuv by plafer 8 years ago
- unix,win: add uv_translate_posix_error Added uv_translate_posix_error to translate posix system call errors (errno) to libuv error codes. Fixes #79 — committed to plafer/libuv by plafer 8 years ago
- unix,win: Exposed uv_translate_sys_error Exposed Windows implementation of uv_translate_sys_error, and added the Unix implementation. The Windows version translates win32 errors into uv errors, whil... — committed to plafer/libuv by plafer 8 years ago
- doc: Add documentation for uv_translate_sys_error uv_translate_sys_error returns the libuv error code equivalent to the given platform dependent error code: POSIX error codes on UNIX and Win32 error ... — committed to plafer/libuv by plafer 8 years ago
- doc: Added versionchanged block to uv_translate_sys_error Specified that the function was declared public and that the UNIX implementation was added in version 2.0.0. Fixes #79 — committed to plafer/libuv by plafer 8 years ago
- test: Add sys_error Ensure that win32 errors on windows and posix errors on unix return the appropriate libuv error with uv_translate_sys_error. Fixes #79 — committed to plafer/libuv by plafer 8 years ago
- test: Added assertions to sys_error Added assertions that would ensure that libuv errors return libuv errors, and that 0 returns 0. Fixes #79 — committed to plafer/libuv by plafer 8 years ago
- unix,win,doc: Expose uv_translate_sys_error uv_translate_sys_error was a private function for Windows. We added the implementation for UNIX. uv_translate_sys_error now returns the libuv error code e... — committed to plafer/libuv by plafer 8 years ago
- Merge pull request #79 from jacquesh/wasapi-device-error-handling WASAPI: Correctly handle no input or output devices instead of crashing. — committed to Crunkle/libuv by andrewrk 8 years ago
Sure.