The C++ core guidelinesC++ core guidelines are the first place to look for. And there’s a whole chapter on error handling.
In short, the preferred way in modern C++ is exception handling with try catch, unless your code needs to be interoperable with C or if the error“error” is not an exceptional situation but a very common one, or for a couple of other very special cases.
Now what to throwthrow? It depends what you want to catchcatch! Throwing strings is for short demo codeis for short demo code. Usually, you’d throw some subclasssome subclass of std::exception, or your own exception class preferably your own exception classes: this allows more selective catch blocsselective catch blocs. A quick look at CEI’s secure coding standard is also very useful.
Finally, you need to be aware that a lot of posts out there on exception management and performance are outdated and rely on drawbacks of earlier exception handling in the nineties. This SO question and the selected answer document this very well.