Nous avons un problème amusant avec try catch et std::runtime_error. Quelqu'un peut-il m'expliquer pourquoi cela renvoie "Erreur inconnue" en sortie ? Merci beaucoup pour votre aide !
#include "stdafx.h"
#include
#include
int magicCode()
{
throw std::runtime_error("ErreurAmusante");
}
int funnyCatch()
{
try{
magicCode();
} catch (std::exception& e) {
throw e;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
try
{
funnyCatch();
}
catch (std::exception& e)
{
std::cout << e.what();
}
return 0;
}