I'm trying to change the way the error files from system/application/errors
work by logging the errors and showing a 404 page instead. However, sometimes the error occurs in the middle of a page and I need to display only the error page.
I've tried to check if the headers are sent and cleaning the output buffer but it didn't work. Any suggestions?
Update: My question seems to confuse people so I'll clarify. My intention is to show a custom 500 page in the event that an error occurs some time after a part of content was sent and log the conditions in which the error occurred so that a user won't see an ugly page and a hacker won't see leaks. The main problem lies in removing the content before the error.
Strategies that didn't work so far:
- checking using
ob_end_clean
$CI = & get_instance(); $CI->output->set_output('only the 500 message');
- adding an
_output($data)
function to the controller and echo-ing only the 500 message if a certain pattern found in thesystem/application/errors/*.php
files is found
Any help is much appreciated.