failed exception stuff

This commit is contained in:
2019-12-11 21:49:54 -06:00
parent 9e47568e67
commit a1ced2ace6
11 changed files with 37 additions and 43 deletions
@@ -13,6 +13,7 @@ use App\Jobs\ProcessAssetsJob;
use App\Library\Esi\Esi;
use Commands\Library\CommandHelper;
use App\Library\Assets\AssetHelper;
use Seat\Eseye\Exceptions\RequestFailedException;
//Models
use App\Models\Jobs\JobProcessAsset;
+12 -8
View File
@@ -2,17 +2,18 @@
namespace App\Console\Commands;
//Internal Library
use Illuminate\Console\Command;
use DB;
use Commands\Library\CommandHelper;
//Models
use App\Models\Corporation\AllianceCorp;
use App\Models\ScheduledTask\ScheduleJob;
use Seat\Eseye\Cache\NullCache;
use Seat\Eseye\Configuration;
use Seat\Eseye\Containers\EsiAuthentication;
use Seat\Eseye\Eseye;
//Library
use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi;
class GetCorpsCommand extends Command
{
@@ -51,15 +52,18 @@ class GetCorpsCommand extends Command
$task = new CommandHelper('CorpJournal');
//Add the entry into the jobs table saying the job is starting
$task->SetStartStatus();
//Declare some variables
$esiHelper = new Esi;
//Create the ESI container
$esi = new Eseye();
$esi = $esiHelper->SetupEsiAuthentication();
//try the esi call to get all of the corporations in the alliance
try {
$corporations = $esi->invoke('get', '/alliances/{alliance_id}/corporations/', [
'alliance_id' => 99004116,
]);
} catch(\Seat\Eseye\Exceptions\RequestFailedException $e){
} catch(RequestFailedException $e){
dd($e->getEsiResponse());
}
//Delete all of the entries in the AllianceCorps table
@@ -69,7 +73,7 @@ class GetCorpsCommand extends Command
$corpInfo = $esi->invoke('get', '/corporations/{corporation_id}/', [
'corporation_id' => $corp,
]);
} catch(\Seat\Eseye\Exceptions\RequestFailedException $e) {
} catch(RequestFailedException $e) {
return $e->getEsiResponse();
}
$entry = new AllianceCorp;
@@ -9,6 +9,7 @@ use Log;
use App\Library\Structures\StructureHelper;
use App\Library\Esi\Esi;
use Commands\Library\CommandHelper;
use Seat\Eseye\Exceptions\RequestFailedException;
//Job
use App\Jobs\ProcessStructureJob;
@@ -82,7 +83,7 @@ class GetStructuresCommand extends Command
}
//Get the refresh token from the database
$token = EsiToken::where(['character_id' => $charId])->get(['refresh_token']);
$token = $esiHelper->GetRefreshToken($charId);
//Create the esi authentication container
$esi = $esiHelper->SetupEsiAuthentication($token);
+6 -5
View File
@@ -7,10 +7,8 @@ use Illuminate\Console\Command;
use Log;
//Libraries
use Seat\Eseye\Cache\NullCache;
use Seat\Eseye\Configuration;
use Seat\Eseye\Containers\EsiAuthentication;
use Seat\Eseye\Eseye;
use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi;
//Models
use App\Models\User\User;
@@ -60,8 +58,11 @@ class PurgeUsers extends Command
*/
public function handle()
{
//Declare some variables
$esiHelper = new Esi;
//Setup the esi variable
$esi = new Eseye();
$esi = $esiHelper->SetupEsiAuthentication();
//Get all of the users from the database
$users = User::all();