mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Improve error handling (#3344)
* Fixes for travis * Minor Fixes * Improve Error Handling
This commit is contained in:
parent
be4cacf198
commit
69cc88e33f
@ -72,7 +72,7 @@ before_script:
|
||||
# sh -e /etc/init.d/xvfb start
|
||||
# sleep 3
|
||||
# ./vendor/laravel/dusk/bin/chromedriver-linux &
|
||||
- php artisan dusk:chrome-driver 72
|
||||
- php artisan dusk:chrome-driver 80
|
||||
- php artisan serve &
|
||||
|
||||
script:
|
||||
|
@ -71,7 +71,7 @@ class Handler extends ExceptionHandler
|
||||
public function render($request, Exception $exception)
|
||||
{
|
||||
if ($exception instanceof ModelNotFoundException && $request->expectsJson()) {
|
||||
return response()->json(['message'=>'Record not found'], 400);
|
||||
return response()->json(['message'=>$exception->getMessage()], 400);
|
||||
} elseif ($exception instanceof ThrottleRequestsException && $request->expectsJson()) {
|
||||
return response()->json(['message'=>'Too many requests'], 429);
|
||||
} elseif ($exception instanceof FatalThrowableError && $request->expectsJson()) {
|
||||
|
@ -13,6 +13,7 @@ namespace App\Models;
|
||||
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException;
|
||||
use App\Filters\QueryFilters;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\UserSessionAttributes;
|
||||
@ -153,6 +154,9 @@ class BaseModel extends Model
|
||||
*/
|
||||
public function resolveRouteBinding($value)
|
||||
{
|
||||
if(is_numeric($value))
|
||||
throw new ModelNotFoundException("Record with value {$value} not found");
|
||||
|
||||
return $this
|
||||
->withTrashed()
|
||||
->where('id', $this->decodePrimaryKey($value))->firstOrFail();
|
||||
|
@ -14,7 +14,7 @@ use App\Models\Payment;
|
||||
use App\Services\AbstractService;
|
||||
use App\Services\Customer\CustomerService;
|
||||
use App\Services\Payment\PaymentService;
|
||||
use App\Traits\GeneratesCounter;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
|
||||
class ApplyNumber extends AbstractService
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user