fix i18n when http exception occurs

This commit is contained in:
printempw 2016-09-28 17:54:00 +08:00
parent 1618707e5d
commit fd7afd2ead

View File

@ -3,6 +3,7 @@
namespace App\Exceptions;
use Exception;
use App\Http\Middleware\Internationalization;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Validation\ValidationException;
use Symfony\Component\HttpKernel\Exception\HttpException;
@ -55,6 +56,11 @@ class Handler extends ExceptionHandler
exit;
}
if ($e instanceof HttpException) {
// call i18n middleware manually since http exceptions won't be sent through it
(new Internationalization)->handle($request, function(){});
}
if ($e instanceof ValidationException) {
return $e->getResponse()->setStatusCode(200);
}