Php throw new exception parameters
What I do, is have a class to create custom exceptions, but to standardise matters, I simply have one additional argument, which is an object (well, so far it's always been an array), which allows me to specify unlimited amount of exception data (much like a javascript exception). Show Output:
This is achieved by the following in my code:
Not too difficult... and the magic behind CustomException.php is Table of Contents
PHP has an exception model similar to that of other programming languages. An exception can be If an exception is thrown and its current function scope has no The thrown object must be an instance of the Exception class or a subclass of Exception. Trying to throw an object that is not will result in a PHP Fatal Error. As of PHP 8.0.0, the
|