as the title says, try/catch
doesn't catch throwed exception.
Here is my code:
public function edit($id)
{
try {
$this->permissions($id);
return $this->redirect(['edit/list']);
} catch (Exception $e) {
Yii::$app->session->setFlash('error', Yii::t('app', 'PERMISSIONS_NOT_FOUND'));
}
}
I'm trying to catch an exception which is in permissions()
method. Permissions method is:
private function persimssions($id)
{
$permitted = false;
if (!$permitted) {
throw new ForbiddenHttpException(Yii::t('app', 'MODULE_NO_PERMISSIONS'));
}
}
Could someone explain me what is wrong? Thanks for any help