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 Commands\Library\CommandHelper;
use App\Library\Assets\AssetHelper;
use Seat\Eseye\Exceptions\RequestFailedException;
//Models
use App\Models\Jobs\JobProcessAsset;

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;

View File

@@ -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);

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();

View File

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

View File

@@ -9,10 +9,6 @@ use Log;
use DB;
//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 App\Library\Esi\Esi;
use App\Library\Structures\StructureHelper;

View File

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

View File

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

View File

@@ -7,10 +7,6 @@ use DB;
use Log;
//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 App\Library\Esi\Esi;
@@ -30,7 +26,10 @@ class NewLookupHelper {
//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) {

View File

@@ -13,10 +13,6 @@ use Log;
use DB;
//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 App\Library\Esi\Esi;
use App\Library\Lookups\NewLookupHelper;

View File

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