Skip to content

Commit 3e700d1

Browse files
authored
Update Controller.php
1 parent afe01f1 commit 3e700d1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Controller.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,12 @@ public function behaviors()
3838
];
3939
}
4040

41-
public function beforeAction($action)
41+
public function init()
4242
{
43-
if ($action == 'index') {
44-
// Replace error handler, so error response is a correct JSON-RPC one
45-
Yii::$app->set('errorHandler', ['class' => ErrorHandler::className()]);
46-
}
43+
Yii::$app->set('errorHandler', ['class' => ErrorHandler::className()]);
44+
Yii::$app->getErrorHandler()->register();
4745

48-
return true;
46+
parent::init();
4947
}
5048

5149
}

0 commit comments

Comments
 (0)