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:
parent
0a4d55e0aa
commit
c905e781c0
@ -69,7 +69,9 @@ class Handler extends ExceptionHandler
|
|||||||
*/
|
*/
|
||||||
public function render($request, Exception $e)
|
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
|
// prevent loop since the page auto-submits
|
||||||
if ($request->path() != 'get_started') {
|
if ($request->path() != 'get_started') {
|
||||||
// https://gist.github.com/jrmadsen67/bd0f9ad0ef1ed6bb594e
|
// https://gist.github.com/jrmadsen67/bd0f9ad0ef1ed6bb594e
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
<?php namespace App\Http\Requests;
|
<?php namespace App\Http\Requests;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Input;
|
use Input;
|
||||||
use Utils;
|
use Utils;
|
||||||
use App\Libraries\HistoryUtils;
|
use App\Libraries\HistoryUtils;
|
||||||
@ -38,28 +36,12 @@ class EntityRequest extends Request {
|
|||||||
|
|
||||||
$class = Utils::getEntityClass($this->entityType);
|
$class = Utils::getEntityClass($this->entityType);
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
if (method_exists($class, 'trashed')) {
|
if (method_exists($class, 'trashed')) {
|
||||||
$this->entity = $class::scope($publicId)->withTrashed()->firstOrFail();
|
$this->entity = $class::scope($publicId)->withTrashed()->firstOrFail();
|
||||||
} else {
|
} else {
|
||||||
$this->entity = $class::scope($publicId)->firstOrFail();
|
$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;
|
return $this->entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user