There are various ways in software to handle error conditions. In C or Go, one returns error code. Other programming languages like C++ or Java prefer to throw exceptions. One benefit of using exceptions is that it keeps your code mostly clean since the error-handling code is often separate.
It is debatable whether handling exceptions is better than dealing with error codes. I will happily use one or the other.
What I will object to, however, is the use of exceptions for control flow. It is fine to throw an exception when a file cannot be opened, unexpectedly. But you should not use exceptions to branch on the type of a value.
Let me illustrate.
Suppose that my code expects integers to be always positive. I might then have a function that checks such a condition:
int get_positive_value(int x) { if(x