Try Catch blocks inside or outside of functions and error handing

In general, an exception should only be caught if it can actually be handled.

It makes no sense to catch an exception for no purpose other than to log it. The exception is that exceptions should be caught at the “top level” so that it can be logged. All other code should allow exceptions to propagate to the code that will log them.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)