You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Lodging an issue for this; I might be inclined to develop a pull request.)
C++11 introduces an error_code class that can accommodate both POSIX standard error codes and alternative collections of error codes such as NNG's. An error_code includes an integer value (0 for no error) and an error category which can be either the C++/POSIX one or some custom category. nngpp would benefit from implementing a custom error category.
https://en.cppreference.com/w/cpp/error/error_category
Implementations of std::error_category have a few responsibilities: Categorizing error codes, providing string representations, and mapping platform-dependent codes to platform-agnostic ones (including standard C++/POSIX error codes). These functions serve to make codebases more consistent and integrable; for example, libasio uses std::error_code extensively.
I recommend making nng::error convertible to std::error_code and/or adding a method for doing so to nng::exception.
These codes would need to be either lossily mapped to C++ codes or implemented as an NNG-specific error_condition. It would be somewhat advantageous to assign them values that don't conflict with the standard C++ ones.
The text was updated successfully, but these errors were encountered:
(Lodging an issue for this; I might be inclined to develop a pull request.)
C++11 introduces an error_code class that can accommodate both POSIX standard error codes and alternative collections of error codes such as NNG's. An error_code includes an integer value (0 for no error) and an error category which can be either the C++/POSIX one or some custom category. nngpp would benefit from implementing a custom error category.
https://en.cppreference.com/w/cpp/error/error_category
Implementations of std::error_category have a few responsibilities: Categorizing error codes, providing string representations, and mapping platform-dependent codes to platform-agnostic ones (including standard C++/POSIX error codes). These functions serve to make codebases more consistent and integrable; for example, libasio uses std::error_code extensively.
I recommend making nng::error convertible to
std::error_code
and/or adding a method for doing so tonng::exception
.The POSIX error codes supported by C++11 are listed here: https://en.cppreference.com/w/cpp/error/errc
The following codes have no direct mapping to a C++/POSIX equivalent.
These codes would need to be either lossily mapped to C++ codes or implemented as an NNG-specific
error_condition
. It would be somewhat advantageous to assign them values that don't conflict with the standard C++ ones.The text was updated successfully, but these errors were encountered: