فهرست منبع

Throw http not found exception instead of runtime

Avoids a 500 server error.
Emmanuel Vella 11 سال پیش
والد
کامیت
3904eaedc6
1فایلهای تغییر یافته به همراه4 افزوده شده و 2 حذف شده
  1. 4 2
      Controller/CRUDController.php

+ 4 - 2
Controller/CRUDController.php

@@ -391,8 +391,10 @@ class CRUDController extends Controller
      */
      */
     public function batchAction()
     public function batchAction()
     {
     {
-        if ($this->getRestMethod() != 'POST') {
-            throw new \RuntimeException('invalid request type, POST expected');
+        $restMethod = $this->getRestMethod();
+
+        if ('POST' !== $restMethod) {
+            throw $this->createNotFoundException(sprintf('Invalid request type "%s", POST expected', $restMethod));
         }
         }
 
 
         // check the csrf token
         // check the csrf token