Category : exception

I have tried so many different ways to solve this problem but nothing seems to be working. How do I fix it? I tried: -setting auto increment for table. -reinstalling php laravel, re-installing and checking all the configuration of PHP -Clearning php artisan cache, config.. etc -Refreshing php artisan. -Making sure the file permissions are ..

Read more

Hubspot is returning errors i.e. for an exiting contact as a string looking something like this (dump) when an exception occurs: Client error: ‘POST https://api.hubapi.com/contacts/v1/contact?hapikey=***’ resulted in a ‘409 Conflict’ response: {"message":"Contact already exists","identityProfile":{"vid":851,"identity":[{"value":"[email protected]"," (truncated…) What is the best way to access the values of "message" and "vid" in PHP or jQuery/Javascript? here’s the php ..

Read more

Tengo el siguiente error laravel 5.8 SymfonyComponentHttpKernelExceptionMethodNotAllowedHttpException: The GET method is not supported for this route. Supported methods: POST. in file /var/www/vhosts/oceanlearning.net/oceanlearning/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php on line 256 Envió peticiones post desde postman pero laravel las recibe como si fueran get, en un principio pensé que era un error de postman pero probé desde otros medio y me ..

Read more

In my Laravel application berkayk/onesignal-laravel package is used for notifications. And currently, it is not working and I need to log the onesignal response so I can debug the issue. Below is my function: $workspace = !empty(Config::get(‘system.one_signal_workspace’))?Config::get(‘system.one_signal_workspace’):false; $notification = null; if(!$workspace){ Log::alert([‘Workspace Not Found’]); } if(!empty($data)){ if(isset($data[‘type’])) $obj->type = $data[‘type’]; if(isset($data[‘notification_obj’])) $obj->notification = $data[‘notification_obj’]; try ..

Read more

I am building a class wrapper around the themoviedb.org api. I’m using guzzle 7 for the requests, but it seems that it is not throwing any exception. class TMDBScraper{ private string $apiKey; private string $language; private Client $client; private const API_URL = "http://api.themoviedb.org/3/"; private const IMAGE_URL = "http://image.tmdb.org/t/p/"; private const POSTER_PATH_SIZE = "w500"; private const ..

Read more

In my laravel based application, when updating user accounts I’m trying to validate the birthday field. I have the following in my controller’s update method ‘date_of_birth’=>[‘required’,’date’, ‘date_format:Y-m-d’, function ($attribute, $value, $fail) { $age=Carbon::createFromFormat(‘Y-m-d’, $value)->diff(Carbon::now())->y; if($age<18||$age>70){ $fail(‘Âge invalide. l’âge devrait être 18-70’); } },] So the date format has to be Y-m-d and the age range ..

Read more

In my laravel based application, when creating new user accounts I’m trying to validate the birthday field. I have the following in my controller’s store method ‘date_of_birth’=>[‘required’,’date_format:m/d/Y’,function ($attribute, $value, $fail) { $age=Carbon::parse($value)->diff(Carbon::now())->y; if($age<18||$age>70){ $fail(‘Âge invalide. l’âge devrait être 18-70’); } },] So the date format has to be m/d/Y and the age range has to ..

Read more

I was assigned to find ‘laravel-way’ of how to set different log levels for each type of exception. For example SmsServiceException should report to notice level, while PaymentServiceException – to some custom level. From Laravel docs it seems that recommended approach is to modify report method of AppExceptionsHandler this way: if ($e instanceof SmsServiceException) { ..

Read more

I am trying to create a record with DB::beginTransaction in a try catch so when any exception occurs it rollbacks the database transaction but it’s not working. I have tried to debug not getting what I’m doing wrong DB::beginTransaction(); try { $customer = Customer::insert([ ‘first_name’ => ‘firstname’, ‘last_name’ => ‘lastname’, ’email’ => ‘[email protected]’, ‘password’ => ..

Read more

I’m currently working on a project where i got stuck on connecting Laravel 8 with Flutter. When I run the API normal inside Postman, everything works perfectly once I try it inside Flutter i got the follow error. Unhandled Exception: SocketException: OS Error: Connection refused, errno = 111, address = [IP Address Server], port = ..

Read more

In my laravel application, I’m trying to handle exceptions by using multiple catch statements from the controller. I have the following catch blocks in my controller function. catch(IlluminateDatabaseQueryException $e) { return response()->view(‘errors.500’, [], 500); } catch(Exception $e){ return redirect()->route(‘roles.index’) ->with(‘failed’,__(‘texts.An error has been occured.’)); } This handles the query exceptions correctly but whenever I try ..

Read more

I am using Lumen 8 and my Handler.php file code is as: public function render($request, Throwable $exception) { if($exception->getStatusCode() == 404){ return response(view("errors.404"), 404); } if($exception->getStatusCode() == 500){ return response(view("errors.500"), 500); } return parent::render($request, $exception); } I have added 404.blade.php and 500.blade.php files in resources/views/errors folder but it is not rendering to view files. Could ..

Read more

Want to have different error handling for different kind of exception and one block for all uncaught exception. (Handler.php) But is is executing both if ValidationException is being thrown. It prints ‘ss’ and ‘dd’ and final response is sent as 500 HTTP status code. Cant find anything regarding that in official doc. reportable() does have ..

Read more