aboutsummaryrefslogtreecommitdiff
path: root/docs/src
diff options
context:
space:
mode:
authorPhilippe Laferriere <laferriere.phil@gmail.com>2016-09-18 15:18:48 -0400
committercjihrig <cjihrig@gmail.com>2016-10-16 17:47:42 -0400
commitf1863dae6bb27e31644307cf0905d42bd41251c9 (patch)
treecdccc02d2f7cb16b95b40d2fc2d97fa85ebadf39 /docs/src
parent6b35ca86161a10cff7a5dee0a3042a5bd21b3bf3 (diff)
downloadlibuv-f1863dae6bb27e31644307cf0905d42bd41251c9.tar.gz
libuv-f1863dae6bb27e31644307cf0905d42bd41251c9.zip
unix,win: add uv_translate_sys_error() public API
uv_translate_sys_error() was a private function for Windows. This commit adds an equivalent function on other platforms, and exposes it as public API. Exposing this is useful in scenarios where the application uses both libuv functions and platform-specific system calls and wants to report errors uniformly as libuv errors. Fixes: https://github.com/libuv/libuv/issues/79 PR-URL: https://github.com/libuv/libuv/pull/1060 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Diffstat (limited to 'docs/src')
-rw-r--r--docs/src/errors.rst10
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/src/errors.rst b/docs/src/errors.rst
index 2ebaf1e4..4e30447b 100644
--- a/docs/src/errors.rst
+++ b/docs/src/errors.rst
@@ -332,3 +332,13 @@ API
Returns the error name for the given error code. Leaks a few bytes
of memory when you call it with an unknown error code.
+
+.. c:function:: int uv_translate_sys_error(int sys_errno)
+
+ Returns the libuv error code equivalent to the given platform dependent error
+ code: POSIX error codes on Unix (the ones stored in `errno`), and Win32 error
+ codes on Windows (those returned by `GetLastError()` or `WSAGetLastError()`).
+
+ If `sys_errno` is already a libuv error, it is simply returned.
+
+ .. versionchanged:: 1.10.0 function declared public.