Re: [Cppcms-users] SIGABRT problem raised between SVN rev1474 and 1491
Brought to you by:
artyom-beilis
|
From: Artyom <art...@ya...> - 2010-10-27 19:43:17
|
>
> I wrote a code sample, which consists only of a main function and a throw
> and reproduces the problem. It's attached to this mail.
int main() {
throw(cppcms::json::bad_value_cast("Loading any of the configuration files
given failed."));
}
If you throw an exception somewhere you should catch it somewhere...
If unhandled exception is thrown it calls std::terminate that in his turn calls
abort...
This is expected behavior
You need to write
int main()
{
try {
throw cppcms::json::bad_value_cast("Loading any of the configuration
files given failed.");
}
catch(std::exception const &e) {
std::cerr << "Catched exception " << e.what() << std::endl;
return 1;
}
return 0;
}
Actually it is good paratice to make a try...catch block around your all code
and catch all
exceptions and print what happens.
Artyom
|