From 2ddaecdadb8a931188b3f3e6b8ad43b9cba45d0f Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 12 Jan 2025 14:43:31 -0800 Subject: api: extend usage of nng_err This replaces the int, and we will expand this further, as this makes it clear that the int is actually an error code and helps in debuggers that can provide symbolic values. --- docs/ref/api/errors.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'docs/ref/api/errors.md') diff --git a/docs/ref/api/errors.md b/docs/ref/api/errors.md index 2a4ccc93..c7a50780 100644 --- a/docs/ref/api/errors.md +++ b/docs/ref/api/errors.md @@ -1,5 +1,9 @@ # Errors +```c +typedef enum ... nng_err; +``` + Many _NNG_ functions can fail for a variety of reasons. These functions tend to return either zero on success, or a non-zero error code to indicate failure. @@ -7,7 +11,11 @@ or a non-zero error code to indicate failure. which behave the same way, but _NNG_ does not use a separate _errno_ variable.}} -All these error codes are `int`. +All these error codes are `nng_err`. + +> [!NOTE] +> Many APIs are still using `int`, but the `nng_err` enumeration can be used +> instead, and will help with debugging. Not every possible error code is defined here, as sometimes an underlying system or library error code is "wrapped". @@ -15,7 +23,7 @@ an underlying system or library error code is "wrapped". ## Human Readable Error Message ```c -const char *nng_strerror(int err); +const char *nng_strerror(nng_err err); ``` The {{i:`nng_strerror`}} returns the human-readable description of the -- cgit v1.2.3-70-g09d2