errno() and strerror() is a typical C language style.
Besides above, you can use some custom function pointer to do some custom
error handling behavior, such as set_new_handler function for new
operator
In general, you should detect errors by checking return values, and
use errno or perror() only to distinguish among the various causes
of an error, such as "File not found" or "Permission denied."
It’s only necessary to detect errors with errno when a function
does not have a unique, unambiguous, out-of-band error return
(that is, because all of its possible return values are valid; one
example is atoi()). In these cases (and in these cases only; check
the documentation to be sure whether a function allows this),
you can detect errors by setting errno to 0, calling the function, and
then testing errno. (Setting errno to 0 first is important, as no library
function ever does that for you.)