-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide examples of using WindowsError and SystemError in the docs #54
Comments
Okay as discussed, here my example code that will let the user run through the Windows error codes by using the C++11 random generators - because #include <chrono>
#include <random>
unsigned long ulError = GetLastError(); // Get the error in this way
// Setup the random number generator
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
std::default_random_engine generator(seed);
std::uniform_int_distribution<unsigned short> distribution (0, 15999); // Range of the Windows Error Codes
unsigned short rand_error = distribution (generator);
fmt::WindowsError gimmError (rand_error, " TestError: ");
cerr << "\n***ERROR (" << rand_error << ")" << gimmError.what(); Output if you enter a number that is not a Windows error code: |
Thanks! |
Added examples, but still need to clarify what happens if you pass an invalid error code. |
Fixed in 326ade7. |
Took me only 7 months to close this =) |
Cool 👍 |
The text was updated successfully, but these errors were encountered: