Error Handling - GeSHi/geshi-1.0 GitHub Wiki

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.