About 50 results
Open links in new tab
  1. php - What are the best practices for catching and re-throwing ...

    I agree only with the last 2 reasons : 1/ handling the exception : you shouldn't do it at this level, 2/ logging or cleanup : use finally and log the exception above your datalayer

  2. php - Custom Exception Messages: Best practices - Stack Overflow

    Krzysztof's blog suggests re-using existing types. ie. FileNotFoundException, NullArgumentException, etc. PHP, however, only has one exception type - Exception. It can …

  3. exception - Best way to handle errors on a php page? - Stack …

    Aug 10, 2012 · What's the best way of handling errors, fatal or not, in a php application that builds and outputs an HTML page? I don't want to just die with a blank screen, as that would be very …

  4. PHP: exceptions vs errors? - Stack Overflow

    May 9, 2009 · Unfortunately PHP's error handling is a complete mess - all kinds of things trigger errors unnecessarily (the vast majority of the file system functions, for example). In general …

  5. php - Try / catch in mysqli - Stack Overflow

    Aug 30, 2017 · 24 If you need to catch exceptions on mysqli extension by use try/catch block, try this code (switch on exception mode instead of classic error reporting):

  6. How to catch all PHP errors? - Stack Overflow

    Jul 20, 2020 · As of PHP 8 the best way to catch any and all Exceptions is to catch the Throwable interface which "is the base interface for any object that can be thrown via a throw statement". …

  7. PHP, How to catch a division by zero? - Stack Overflow

    Jun 18, 2010 · PHP5 brought exceptions to the table, and newer PHP provided libraries (PDO) will throw exceptions when bad/unexpected things happen. Hoever, the core codebase was …

  8. mysql - PHP Try and Catch for SQL Insert - Stack Overflow

    As long as it's used in the php file you may be able to catch the mysqli_sql_exceptionS.

  9. php - Why is my Laravel 11 exception handler not working

    Jul 2, 2024 · Using Laravel 11, exception handling is moved to the bootstrap/app.php file. I'm trying to catch AuthorizationException and pass the user back to the dashboard with the 403 …

  10. php - Can I try/catch a warning? - Stack Overflow

    Both builder pattern, and options patterns provide solutions for this where prior to the site of call, which can be a private function or just after validity checks, you can throw a real custom …