I am trying to recover the last (fatal) error message through these functions:
$last_error = error_get_last();
echo $last_error['message'];
Using the exception:
throw new Exception("Error n.1");
I would expect to get this string "Error n.1", but I get something like this (which depends on the PHP version):
Uncaught Exception: Error n.1 in C:\wamp\www\JUICE\projects\JATE\dist\jate\functions\errorHandler.php:66 Stack trace: #0 C:\wamp\www\JUICE\projects\JATE\dist\jate\functions\requirer.php(37): require_once() #1 C:\wamp\www\JUICE\projects\JATE\dist\jate\functions\requirer.php(5): jRequire('C:\\wamp\\www\\JUI...', false, 0) #2 C:\wamp\www\JUICE\projects\JATE\dist\jate\functions\requirer.php(15): requireComponent('C:\\wamp\\www\\JUI...', false) #3 C:\wamp\www\JUICE\projects\JATE\dist\jate\coreEngine.php(10): requireComponents('functions') #4 C:\wamp\www\JUICE\projects\JATE\examples\01essential\jate.php(15): require_once('C:\\wamp\\www\\JUI...') #5 C:\wamp\www\JUICE\projects\JATE\examples\01essential\index.php(2): require_once('C:\\wamp\\www\\JUI...') #6 {main} thrown
How can I get the error string and not all the things added by the system?
try/catch? Then you can use$error->getMessage().$last_errorthan that. The error message is just one string, it's not layered in any way just because the error refers to an exception.