What makes the program flow into a catch
is the launch of a throw
. What are the throws
that exist in your application? Which ones are in the libraries you are using? Whether they are PHP standard or additional. You have to read the documentation to find out.
That is, the decision is by the developer of the code. And this is probably in the documentation stating whether you can or should use catch
to catch the exception generated by some API you are using.
PHP has some APIs that you can choose as the error will be generated. But this is not the default for all APIs and you probably will not create this option in your code.