Exception non interceptée
Bonjour,
J'ai ceci et l'exception générée "TEST" n'est pas interceptée et je ne comprends pas pourquoi. Vos lumières seraient le bienvenues.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
class Exception : public std::exception
{
public :
std::string Message;
explicit Exception(std::string const& Mes) throw() : Message(Mes) { }
explicit Exception(const char *Mes) throw() : Message(Mes) { }
virtual const char* what() const throw() { return(exception::what()); }
virtual ~Exception() throw() { }
};
int main() {
try {
throw std::logic_error("TEST"); // n'est pas interceptée dans le catch
throw Exception("TEST2"); // est bien interceptée dans le catch
} catch (Exception &e) {
printf("%s\n",e.massage.c_str();
retrun(1);
}
retrun(0);
} |