Exception handling syntax: Difference between revisions

Content deleted Content added
No edit summary
Tags: Mobile edit Mobile app edit iOS app edit App section source
 
Line 207:
try {
// do something (might throw an exception)
} catch (const std::runtime_error e) {
// handle a runtime_error e
} catch (const std::exception& e) {
// handlecatches exceptionall exceptions as e
} catch (...) {
// catches all exceptionsthrown types (including primitives or objects that do nit extend exception), not already caught by a catch block before
// can be used to catch exception of unknown or irrelevant type
}
}