NN_STRERROR(3)

πŸ“¦
version 1.2.2 Β· 5 versions
, in fedora 44

πŸ’– NN_STRERROR(3) πŸ’–

okay bestie, sit down, we're doing nanomsg error messages and honestly? it's giving helpful. this is from the nanomsg manual, version 1.2.2, and it's literally the nicest little function. πŸŽ€


✨ NAME ✨

nn_strerror β€” turn an error number into a human-readable string πŸ¦‹

like, an actual sentence a person can read instead of a cursed integer. no cap.


🌸 SYNOPSIS 🌸

#include <nanomsg/nn.h>

const char *nn_strerror (int errnum);

πŸ’… DESCRIPTION πŸ’…

So here's the tea: nn_strerror takes an error number (that's your errno, bestie) and converts it into a human-readable string. Simple. Iconic. Slay.

And here's the part where it lowkey outshines the competition: as opposed to strerror(3), this function handles nanomsg-specific errors in addition to standard system errors. so it's strerror(3) but with main character energy β€” it knows about the nanomsg stuff too, not just the regular system stuff. periodt. πŸ‘‘


🫢 RETURN VALUE 🫢

It returns the error message string. that's it, that's the whole vibe. a const char * pointing at words that explain what went wrong. πŸ’–


😭 ERRORS 😭

No errors are defined.

literally none. zero. the error function has no errors. it's that girl. she's unproblematic. πŸ’€βœ¨

🌈 EXAMPLE 🌈

rc = nn_send (s, "ABC", 3, 0);
if (rc < 0)
    printf ("nn_send failed: %s\n", nn_strerror (errno));

see how we check if rc < 0 and then just print the vibe-check result? chef's kiss. that's the pattern, use it, it's free. πŸ“


πŸ‘‘ SEE ALSO πŸ‘‘

go read those too, iykyk. 🧚


πŸ’œ AUTHORS πŸ’œ

Martin Sustrik <sustrik@250bpm.com> β€” thank you for your service, king. πŸ™ˆ


and that's the whole page, bestie!! 🌟 this one was written by Martin Sustrik and it comes to you from the nanomsg 1.2.2 era, dated 2026-01-16. now go forth and print readable errors, you absolute legend. πŸ’…πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from