try { // some code } catch (\Exception $e) { throw new \Exception('Error Found', 500); }
Yii::error('Error Found', 'application');
throw new \yii\web\BadRequestHttpException('Invalid Parameters');
$this->layout = 'error';All of these code examples are part of the Yii framework package library.