Lesson 23 of 24
Exceptions: try, catch and throw
9 min 35 XP
Raise an error with throw and handle it with try/catch. Standard exceptions include invalid_argument, out_of_range and runtime_error; stoi() throws invalid_argument for bad text.
Example: edit me and press Run
Output Loading C++ (first time takes a few seconds)
Press Run to see the result here.