• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Exception Debugger - Good for Gesior AAC.

Paxton

Banned User
Joined
Feb 23, 2008
Messages
4,110
Reaction score
48
Location
London, UK
Hi There, so I wrote my own exception debugger, which helps me a bit with applications, and I came up with idea this could be very good for Gesior AAC because it has a lot of Fatal errors because of uncaught exceptions :)

So create new file in your aac folder called patch.php and paste this into it:

PHP:
<?php
#Paxton Patch 0.1 for uncaught exceptions.
#Set the exception handler to the right function so it will be fired when exception has not been caught,

set_exception_handler('catchException'); 


#The actual function
function catchException($exception) { 
	#Setting error style
    echo "<style>body {background: black;color: white;font-family: system;}</style><center><h2>Fatal Error!</h2>";
	echo "An unexpected error has occured! <br>At the bottom log has been generated please pass those information to the website administrator.";
	echo "<br>Exception has been thrown but it has not been caught.<br><br><br>";
	echo "<font color='silver'>";
	echo "Exception information<br><br>";
	echo "Message received: <i>".$exception->getMessage()."</i><br>";
	echo "File: ".$exception->getFile()."<br>";
	echo "On line: ".$exception->getLine()."<br>";
	echo "Exception code: ".$exception->getCode()."<br><br>";
	echo "Current site<br><br>";
	echo "Error shown on: ".$_SERVER['SCRIPT_FILENAME']."<br><br>";
	echo "Requests<br><br>";
	foreach($_REQUEST as $key => $value){echo "$key :: $value <br>";}
	echo "<br><br>";
	echo "Last errors<br><br>";
	foreach(error_get_last() as $key => $value){ echo "$key :: $value <br>";}
	echo "</font>";
	#Exit the application, mostly not needed but for future.
	exit;
} 


?>

Now open your index.php and paste this line:
PHP:
include("patch.php");

Somewhere at line: 10

Ok, so it really helps finding the error, and it doesn't show nasty fatal error so visitors can actually understand what's going on.

Here is the example of log received after uncaught exception.
Fatal Error!
An unexpected error has occured!
At the bottom log has been generated please pass those information to the website administrator.
Exception has been thrown but it has not been caught.


Exception information

Message received: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'acc.z_shop_offer' doesn't exist
File: C:\xampp\htdocs\acc\shopsystem.php
On line: 55
Exception code: 42S02

Current site

Error shown on: C:/xampp/htdocs/acc/index.php

Requests

subtopic :: shopsystem
PHPSESSID :: da2588888a8c607bcf120bdce429638f


Last errors

type :: 8
message :: Undefined variable: main_content
file :: C:\xampp\htdocs\acc\shopsystem.php
line :: 98

Thanks.
 
is there any hotkey i can use so i can go directly to row/line ?
insteed ouf counting each row and line xd
 
No, this actually shows on the website, so there is no way of doing it.

However, it shows what line and what file so you can easily use programs such Notepad++ to find this error.
 
Fatal error: Cannot redeclare catchexception() (previously declared in C:\xampp\htdocs\patch.php:9) in C:\xampp\htdocs\patch.php on line 30Fatal error: Cannot redeclare catchexception() (previously declared in C:\xampp\htdocs\patch.php:9) in C:\xampp\htdocs\patch.php on line 30
WTF ? xd
 
Back
Top