diff options
| author | Garrett D'Amore <garrett@damore.org> | 2025-01-12 14:43:31 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2025-01-12 14:43:31 -0800 |
| commit | 2ddaecdadb8a931188b3f3e6b8ad43b9cba45d0f (patch) | |
| tree | ddab0fbc8bb631fc31c233e09cd83a561988158d /docs/ref/api/errors.md | |
| parent | d88484cafbf973d55dc95b7edcae5064efa8bad0 (diff) | |
| download | nng-2ddaecdadb8a931188b3f3e6b8ad43b9cba45d0f.tar.gz nng-2ddaecdadb8a931188b3f3e6b8ad43b9cba45d0f.tar.bz2 nng-2ddaecdadb8a931188b3f3e6b8ad43b9cba45d0f.zip | |
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.
Diffstat (limited to 'docs/ref/api/errors.md')
| -rw-r--r-- | docs/ref/api/errors.md | 12 |
1 files changed, 10 insertions, 2 deletions
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 |
