mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 12:42:36 +01:00
revert error reporting (#1142)
This commit is contained in:
parent
0a4d55e0aa
commit
c905e781c0
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user