Hide errors messages

Hi, all!

When user visiting site by GET they see site as OK. But this are RESTFUL API server and when change method to PUT shown errors: http://joxi.ru/ZrJE6DkCvja5Aj

Functions of controller to separate request:




    public function behaviors(){

        return [

            'verbs' => [

                'class' => VerbFilter::className(),

                'actions' => [

                    'index' => ['get'],

                    'upload' => ['post']

                ],

            ]

        ];

    }


    public function beforeAction( $event ){

        $action = $event->id;

        if (isset($this->actions[$action])) {

            $verbs = $this->actions[$action];

        } elseif (isset($this->actions['*'])) {

            $verbs = $this->actions['*'];

        } else {

            return $event->isValid;

        }

        $verb = \Yii::$app->getRequest()->getMethod();

        

        if ( !in_array( $verb, $allowed ) ){

            echo 'Method not allowed';

            exit;

        }


        return false;

    }



How can hide errors messages when user try visit page with PUT method? Maybe redirect or show own message.