From 548e06514146ef9bdf539071eca9247955162f4f Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Tue, 13 Nov 2018 23:00:24 -0600 Subject: [PATCH] config for esi --- app/Library/Fleet.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/app/Library/Fleet.php b/app/Library/Fleet.php index afd33a73f..f2b046785 100644 --- a/app/Library/Fleet.php +++ b/app/Library/Fleet.php @@ -97,6 +97,7 @@ class Fleet { // FileCache. $configuration = Configuration::getInstance(); $configuration->cache = NullCache::class; + $configuration->logfile_location = '/var/www/w4rpservices/storage/eseye'; //Create the ESI Call Container $authentication = new EsiAuthentication([ 'client_id' => env('ESI_CLIENT_ID'), @@ -108,9 +109,24 @@ class Fleet { //Setup the body of the esi message $esi->setBody(['character_id' => $charId, 'role' => 'squad_member']); //Perform the call to ESI - $error = $esi->invoke('post', '/fleets/{fleet_id}/members/', [ - 'fleet_id' => $fleetId, - ]); + try { + $esi->invoke('post', '/fleets/{fleet_id}/members/', [ + 'fleet_id' => $fleetId, + ]); + } catch(\Seat\Eseye\Exceptions\RequestFailedException $e) { + // The HTTP Response code and message can be retreived + // from the exception... + print $e->getCode() . PHP_EOL; + print $e->getMessage() . PHP_EOL; + + // .. or from the EsiResponse available from the Exception + print $e->getEsiResponse()->getErrorCode() . PHP_EOL; + print $e->getEsiResponse()->error() . PHP_EOL; + + // You can also access the *actual* response we got from + // ESI as a normal array. + print_r($e->getEsiResponse()); + } return 'Invite Sent'; }