Browse Source

Throw http not found exception instead of runtime

Avoids a 500 server error.
Emmanuel Vella 11 years ago
parent
commit
3904eaedc6
1 changed files with 4 additions and 2 deletions
  1. 4 2
      Controller/CRUDController.php

+ 4 - 2
Controller/CRUDController.php

@@ -391,8 +391,10 @@ class CRUDController extends Controller
      */
     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