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

View File

@@ -13,6 +13,7 @@ use App\Jobs\ProcessAssetsJob;
use App\Library\Esi\Esi; use App\Library\Esi\Esi;
use Commands\Library\CommandHelper; use Commands\Library\CommandHelper;
use App\Library\Assets\AssetHelper; use App\Library\Assets\AssetHelper;
use Seat\Eseye\Exceptions\RequestFailedException;
//Models //Models
use App\Models\Jobs\JobProcessAsset; use App\Models\Jobs\JobProcessAsset;

View File

@@ -2,17 +2,18 @@
namespace App\Console\Commands; namespace App\Console\Commands;
//Internal Library
use Illuminate\Console\Command; use Illuminate\Console\Command;
use DB; use DB;
use Commands\Library\CommandHelper; use Commands\Library\CommandHelper;
//Models
use App\Models\Corporation\AllianceCorp; use App\Models\Corporation\AllianceCorp;
use App\Models\ScheduledTask\ScheduleJob; use App\Models\ScheduledTask\ScheduleJob;
use Seat\Eseye\Cache\NullCache; //Library
use Seat\Eseye\Configuration; use Seat\Eseye\Exceptions\RequestFailedException;
use Seat\Eseye\Containers\EsiAuthentication; use App\Library\Esi\Esi;
use Seat\Eseye\Eseye;
class GetCorpsCommand extends Command class GetCorpsCommand extends Command
{ {
@@ -52,14 +53,17 @@ class GetCorpsCommand extends Command
//Add the entry into the jobs table saying the job is starting //Add the entry into the jobs table saying the job is starting
$task->SetStartStatus(); $task->SetStartStatus();
//Create the ESI container //Declare some variables
$esi = new Eseye(); $esiHelper = new Esi;
$esi = $esiHelper->SetupEsiAuthentication();
//try the esi call to get all of the corporations in the alliance //try the esi call to get all of the corporations in the alliance
try { try {
$corporations = $esi->invoke('get', '/alliances/{alliance_id}/corporations/', [ $corporations = $esi->invoke('get', '/alliances/{alliance_id}/corporations/', [
'alliance_id' => 99004116, 'alliance_id' => 99004116,
]); ]);
} catch(\Seat\Eseye\Exceptions\RequestFailedException $e){ } catch(RequestFailedException $e){
dd($e->getEsiResponse()); dd($e->getEsiResponse());
} }
//Delete all of the entries in the AllianceCorps table //Delete all of the entries in the AllianceCorps table
@@ -69,7 +73,7 @@ class GetCorpsCommand extends Command
$corpInfo = $esi->invoke('get', '/corporations/{corporation_id}/', [ $corpInfo = $esi->invoke('get', '/corporations/{corporation_id}/', [
'corporation_id' => $corp, 'corporation_id' => $corp,
]); ]);
} catch(\Seat\Eseye\Exceptions\RequestFailedException $e) { } catch(RequestFailedException $e) {
return $e->getEsiResponse(); return $e->getEsiResponse();
} }
$entry = new AllianceCorp; $entry = new AllianceCorp;

View File

@@ -9,6 +9,7 @@ use Log;
use App\Library\Structures\StructureHelper; use App\Library\Structures\StructureHelper;
use App\Library\Esi\Esi; use App\Library\Esi\Esi;
use Commands\Library\CommandHelper; use Commands\Library\CommandHelper;
use Seat\Eseye\Exceptions\RequestFailedException;
//Job //Job
use App\Jobs\ProcessStructureJob; use App\Jobs\ProcessStructureJob;
@@ -82,7 +83,7 @@ class GetStructuresCommand extends Command
} }
//Get the refresh token from the database //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 //Create the esi authentication container
$esi = $esiHelper->SetupEsiAuthentication($token); $esi = $esiHelper->SetupEsiAuthentication($token);

View File

@@ -7,10 +7,8 @@ use Illuminate\Console\Command;
use Log; use Log;
//Libraries //Libraries
use Seat\Eseye\Cache\NullCache; use Seat\Eseye\Exceptions\RequestFailedException;
use Seat\Eseye\Configuration; use App\Library\Esi\Esi;
use Seat\Eseye\Containers\EsiAuthentication;
use Seat\Eseye\Eseye;
//Models //Models
use App\Models\User\User; use App\Models\User\User;
@@ -60,8 +58,11 @@ class PurgeUsers extends Command
*/ */
public function handle() public function handle()
{ {
//Declare some variables
$esiHelper = new Esi;
//Setup the esi variable //Setup the esi variable
$esi = new Eseye(); $esi = $esiHelper->SetupEsiAuthentication();
//Get all of the users from the database //Get all of the users from the database
$users = User::all(); $users = User::all();

View File

@@ -10,10 +10,6 @@ use Carbon\Carbon;
//Library //Library
use App\Library\Esi\Esi; use App\Library\Esi\Esi;
use Seat\Eseye\Cache\NullCache;
use Seat\Eseye\Configuration;
use Seat\Eseye\Containers\EsiAuthentication;
use Seat\Eseye\Eseye;
use Seat\Eseye\Exceptions\RequestFailedException; use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Taxes\TaxesHelper; use App\Library\Taxes\TaxesHelper;
@@ -45,7 +41,7 @@ class MarketController extends Controller
//Declare the esi helper //Declare the esi helper
$esiHelper = new Esi; $esiHelper = new Esi;
//Create the esi container to get the character's public information //Create the esi container to get the character's public information
$esi = new Eseye(); $esi = $esiHelper->SetupEsiAuthentication();
try { try {
$charInfo = $esi->invoke('get', '/characters/{character_id}/', [ $charInfo = $esi->invoke('get', '/characters/{character_id}/', [
'character_id' => $charId, 'character_id' => $charId,
@@ -67,9 +63,13 @@ class MarketController extends Controller
} }
public function displayTaxes() { public function displayTaxes() {
//Declare some variables
$esiHelper = new Esi;
$charId = auth()->user()->getId(); $charId = auth()->user()->getId();
$esi = new Eseye(); //Setup the esi authentication container
$esi = $esiHelper->SetupEsiAuthentication();
try { try {
$charInfo = $esi->invoke('get', '/characters/{character_id}/', [ $charInfo = $esi->invoke('get', '/characters/{character_id}/', [
'character_id' => $charId, 'character_id' => $charId,

View File

@@ -9,10 +9,6 @@ use Log;
use DB; use DB;
//App Library //App Library
use Seat\Eseye\Cache\NullCache;
use Seat\Eseye\Configuration;
use Seat\Eseye\Containers\EsiAuthentication;
use Seat\Eseye\Eseye;
use Seat\Eseye\Exceptions\RequestFailedException; use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi; use App\Library\Esi\Esi;
use App\Library\Structures\StructureHelper; use App\Library\Structures\StructureHelper;

View File

@@ -9,6 +9,7 @@ use DB;
//App Library //App Library
use App\Jobs\Library\JobHelper; use App\Jobs\Library\JobHelper;
use App\Library\Esi\Esi; use App\Library\Esi\Esi;
use Seat\Eseye\Exceptions\RequestFailedException;
//Models //Models
use App\Models\Jobs\JobProcessContracts; use App\Models\Jobs\JobProcessContracts;

View File

@@ -34,8 +34,6 @@ use App\Library\Finances\PISale;
use App\Library\Lookups\NewLookupHelper; use App\Library\Lookups\NewLookupHelper;
//Seat Stuff //Seat Stuff
use Seat\Eseye\Containers\EsiAuthentication;
use Seat\Eseye\Eseye;
use Seat\Eseye\Exceptions\RequestFailedException; use Seat\Eseye\Exceptions\RequestFailedException;
@@ -87,7 +85,6 @@ class FinanceHelper {
'division' => $division, 'division' => $division,
]); ]);
} catch(RequestFailedException $e) { } catch(RequestFailedException $e) {
//Log::warning($e->getEsiResponse());
return null; return null;
} }

View File

@@ -7,10 +7,6 @@ use DB;
use Log; use Log;
//Library //Library
use Seat\Eseye\Cache\NullCache;
use Seat\Eseye\Configuration;
use Seat\Eseye\Containers\EsiAuthentication;
use Seat\Eseye\Eseye;
use Seat\Eseye\Exceptions\RequestFailedException; use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi; use App\Library\Esi\Esi;
@@ -30,7 +26,10 @@ class NewLookupHelper {
//Construct //Construct
public function __construct() { public function __construct() {
$this->esi = new Eseye(); //Declare a variable for use by the construct
$esiHelper = new Esi;
$this->esi = $esiHelper->SetupEsiAuthentication();
} }
public function ItemIdToName($itemId) { public function ItemIdToName($itemId) {

View File

@@ -13,10 +13,6 @@ use Log;
use DB; use DB;
//App Library //App Library
use Seat\Eseye\Cache\NullCache;
use Seat\Eseye\Configuration;
use Seat\Eseye\Containers\EsiAuthentication;
use Seat\Eseye\Eseye;
use Seat\Eseye\Exceptions\RequestFailedException; use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi; use App\Library\Esi\Esi;
use App\Library\Lookups\NewLookupHelper; use App\Library\Lookups\NewLookupHelper;

View File

@@ -4,10 +4,8 @@ use Illuminate\Database\Seeder;
use App\Models\Lookups\SolarSystem; use App\Models\Lookups\SolarSystem;
use Seat\Eseye\Cache\NullCache; use Seat\Eseye\Exceptions\RequestFailedException;
use Seat\Eseye\Configuration; use App\Library\Esi\Esi;
use Seat\Eseye\Containers\EsiAuthentication;
use Seat\Eseye\Eseye;
class SolarSystemSeeder extends Seeder class SolarSystemSeeder extends Seeder
{ {
@@ -18,10 +16,10 @@ class SolarSystemSeeder extends Seeder
*/ */
public function run() public function run()
{ {
$configuration = Configuration::getInstance(); //Declare some variables
$configuration->cache = NullCache::class; $esiHelper = new Esi;
$esi = new Eseye(); $esi = $esiHelper->SetupEsiAuthentication();
$systems = $esi->invoke('get', '/universe/systems/'); $systems = $esi->invoke('get', '/universe/systems/');