-
Notifications
You must be signed in to change notification settings - Fork 101
Error Handling
Andreas Gohr edited this page Mar 13, 2017
·
1 revision
What happens if you try to highlight using a language that doesn’t exist? Or if GeSHi can’t read a required file? The results you get may be confusing. You may check your code over and over, and never find anything wrong. GeSHi provides ways of finding out if GeSHi itself found anything wrong with what you tried to do. After highlighting, you can call the error()
method:
$geshi = new GeSHi('hi', 'thisLangIsNotSupported');
echo $geshi->error(); // echoes error message
The error message you will get will look like this:
GeSHi Error: GeSHi could not find the language thisLangIsNotSupported (using path geshi/) (code 2)
The error outputted will be the last error GeSHi came across, just like how mysql_error()
works.