New in KO 3.3 is the HTTP :: redirect method, which works by throwing an HTTP_Exception_302 that bubbles up and is processed by the system for the actual redirect.
My question is: how can I do a redirect without catching its exception if I call a redirect in a try...catch ?
eg:.
try { if($var === TRUE){ HTTP::redirect(URL::site($_REQUEST['redirect_uri'])); }else{ throw new Exception('Error'); } } catch(Exception $e) { $this->template->errors[] = $e->getMessage(); }
This will not result in a redirect, because a generic Exception handler will catch it. How can I avoid this?
source share