Skip to content
Snippets Groups Projects
Commit 4b78bf49 authored by Karsten Suehring's avatar Karsten Suehring
Browse files

revise exception handling in release mode

- catch std::bad_alloc explicitly
- remove catch-all handler
parent a6bd8b15
No related branches found
No related tags found
1 merge request!893revise exception handling in release mode
...@@ -100,9 +100,9 @@ int main(int argc, char* argv[]) ...@@ -100,9 +100,9 @@ int main(int argc, char* argv[])
std::cerr << e.what() << std::endl; std::cerr << e.what() << std::endl;
returnCode = EXIT_FAILURE; returnCode = EXIT_FAILURE;
} }
catch( ... ) catch (const std::bad_alloc &e)
{ {
std::cerr << "Unspecified error occurred" << std::endl; std::cout << "Memory allocation failed: " << e.what() << std::endl;
returnCode = EXIT_FAILURE; returnCode = EXIT_FAILURE;
} }
#endif #endif
......
...@@ -156,12 +156,12 @@ int main(int argc, char* argv[]) ...@@ -156,12 +156,12 @@ int main(int argc, char* argv[])
catch( Exception &e ) catch( Exception &e )
{ {
std::cerr << e.what() << std::endl; std::cerr << e.what() << std::endl;
return 1; return EXIT_FAILURE;
} }
catch( ... ) catch (const std::bad_alloc &e)
{ {
std::cerr << "Unspecified error occurred" << std::endl; std::cout << "Memory allocation failed: " << e.what() << std::endl;
return 1; return EXIT_FAILURE;
} }
#endif #endif
// ending time // ending time
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment