I've read the Exception
methods in order to replace the deprecated JError
, but I can't solve the following problem:
I have a plugin that redirects an user to a login page in case he/she tries to access a page that is for a logged-in user (instead of getting the message "You are not authorised to view this resource.").
It used to work when JError was still around (before J3), the code was like this:
Error::setErrorHandling(E_ERROR, 'callback', array(
'plgSystemCustom_Redirects',
'handleError'
));
And in the rest of the script I had the handleError
function.
My doubt here is (unlike any other examples that I've read) how to catch the error (I'm not able to issue a try
); in other words, how to replace the deprecated code with something that works in Joomla 3.5?
setErrorHandling
doesn't. I have no other way to handle the errors in the same way as before.