createNotFoundException在symfony中不起作用

时间:2018-07-11 03:18:51

标签: symfony

我正在使用symfony 3.2。将页面链接到此页面时,我不知道这里发生了什么

hello_dev.com/app_dev.php/portal/68/facilities/120

我收到这种500 http错误 enter image description here 但是当我将此链接到此

hello_dev.com/app_dev.php/portal/68/facilities/119

我得到的错误页面是正确的 enter image description here 如果您注意到它,我仅将设施120的ID更改为119。所有需要的是同一个错误404页面。我是否会错过有关symfony中设置的信息?这是我后端的代码。只是简单的动作代码。

/**
     * @Route("/{transactionId}/facilities/{transactionFacilityId}", name="portal_get_facility")
     * @param Request $request
     * @throws \RangeException
     * @throws QueryException
     * @return Response
     */
    public function getFacilityAction(Request $request) {
            throw $this->createNotFoundException('Invalid facility');
     }

0 个答案:

没有答案