Exceptions may seem somewhat more technical than if statements, but they are the preferred way to handle errors in C++. Whereas older libraries used to report errors with “error codes,” most modern libraries throw exceptions instead.
In addition, exception handling cleans up the code. While error handling is an important component of any real program, programmers generally want to read normal processing code and error-handling code separately, because that makes each of them easier to understand. Exceptions provide the best way to accomplish this.