1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

revert error reporting (#1142)

This commit is contained in:
David Bomba 2016-11-05 12:32:06 +11:00 committed by GitHub
parent 0a4d55e0aa
commit c905e781c0
2 changed files with 3 additions and 19 deletions

View File

@ -69,7 +69,9 @@ class Handler extends ExceptionHandler
*/
public function render($request, Exception $e)
{
if ($e instanceof \Illuminate\Session\TokenMismatchException) {
if ($e instanceof ModelNotFoundException) {
return Redirect::to('/');
} if ($e instanceof \Illuminate\Session\TokenMismatchException) {
// prevent loop since the page auto-submits
if ($request->path() != 'get_started') {
// https://gist.github.com/jrmadsen67/bd0f9ad0ef1ed6bb594e

View File

@ -1,7 +1,5 @@
<?php namespace App\Http\Requests;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\Request;
use Input;
use Utils;
use App\Libraries\HistoryUtils;
@ -38,28 +36,12 @@ class EntityRequest extends Request {
$class = Utils::getEntityClass($this->entityType);
try {
if (method_exists($class, 'trashed')) {
$this->entity = $class::scope($publicId)->withTrashed()->firstOrFail();
} else {
$this->entity = $class::scope($publicId)->firstOrFail();
}
}
catch(ModelNotFoundException $e) {
if(Request::header('X-Ninja-Token') != '') {
$error['error'] = ['message'=>'Entity not found'];
$error = json_encode($error, JSON_PRETTY_PRINT);
$headers = Utils::getApiHeaders();
return response()->make($error, 400, $headers);
}
}
return $this->entity;
}