Exception handling (programming): Difference between revisions

Content deleted Content added
Line 237:
// ...
} catch (const std::exception& e) {
// Catching only exceptions:
std::println("An exception was caught: {}", e.what());
}
 
// Catching all thrown objects:
try {
// ...
} catch (...) {
// Catching all thrown objects:
std::println("An unknown error was caught");
}