Hi
I’m trying redirect to homepage after I get a SoapFault error in try/catch method
$client = new SoapClient(...);
try
{
$response = $client->listCertificate($params);
return $response->return->userId;
}
catch (SoapFault $fault) // Throwable has same problem
{
Flash::warning('Login failed', false);
// header('location:' . Director::BaseURL()); // works but no Flash message
$this->redirect(Director::BaseURL()); // doesn't work
return false;
}
If I use header('Location: ' . Director::BaseURL());
it redirects, but I don’t get the Flash message.
If I use $this->redirect(Director::BaseURL());
the redirect doesn’t work and the code keeps executing.
Any idea what am I doing wrong and how to fix this?