What errors trigger the catch? [duplicate]

3

In a test similar to this , I stayed in doubts what the errors that generate Exception .

Finding I only found explanations of using try , catch , and some references that this would depend on the php_ini setting.

Well, which errors generate Exception ?

    
asked by anonymous 16.04.2015 / 15:30

1 answer

2

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.

    
16.04.2015 / 15:39