From 085161fbc3451f90f991a0731fbaf0931cb07678 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Thu, 7 May 2015 14:16:13 +0300 Subject: Validation exception; user/login endpoint --- src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php') diff --git a/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php b/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php index 4d6c93c..6351614 100644 --- a/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php +++ b/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php @@ -1,7 +1,6 @@ 'Resource not found'], 404); @@ -47,6 +46,14 @@ class BotleaguesApiServiceProvider extends ServiceProvider { ['error' => !Config::get('app.debug') || empty($e->getMessage()) ? 'Access denied' : $e->getMessage()], 404); }); + API::error(function(Exception\ValidationException $e) { + return Response::make( + [ + 'error' => $e->getMessage(), + 'errors' => $e->errors + ], + 500); + }); API::error(function(\Exception $e) { return Response::make( ['error' => Config::get('app.debug') ? $e->getMessage() : "Internal error"], -- cgit v1.2.3