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
{{ message }}
Repository navigation
Provide examples of using WindowsError and SystemError in the docs #54
Provide 2-3 examples of real Windows error codes in the example so its usage makes sense and mention what happens if you enter a code that is not an official error code.
#include<chrono>
#include<random>unsignedlong ulError = GetLastError(); // Get the error in this way// Setup the random number generatorunsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
std::default_random_engine generator(seed);
std::uniform_int_distribution<unsignedshort> distribution (0, 15999); // Range of the Windows Error Codesunsignedshort 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: ***ERROR (6449) TestError: error code = 6449
Activity
patlecat commentedon Jul 9, 2014
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
rand()must not be used anymore!Here's the list btw: http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx
Output if you enter a number that is not a Windows error code:
***ERROR (6449) TestError: error code = 6449vitaut commentedon Jul 9, 2014
Thanks!
Provide examples of using SystemError and WindowsError (#54)
vitaut commentedon Feb 6, 2015
Added examples, but still need to clarify what happens if you pass an invalid error code.
vitaut commentedon Feb 7, 2015
Fixed in 326ade7.
vitaut commentedon Feb 7, 2015
Took me only 7 months to close this =)
patlecat commentedon Feb 9, 2015
Cool 👍