Browse Source

adding error and success responses

Tim Millwood 10 years ago
parent
commit
9e506893a6
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/Packagist/WebBundle/Controller/ApiController.php

+ 3 - 0
src/Packagist/WebBundle/Controller/ApiController.php

@@ -83,7 +83,10 @@ class ApiController extends Controller
             $em->flush();
         } catch (\Exception $e) {
             $this->get('logger')->crit($e->getMessage(), array('exception', $e));
+            return new JsonResponse(array('status' => 'error', 'message' => $e->getMessage()), 406); 
         }
+
+        return new JsonResponse(array('status' => 'success'), 202);
     }
 
     /**