Skip to content

Commit

Permalink
fix: Errors for Not Found Members
Browse files Browse the repository at this point in the history
  • Loading branch information
CalumTowers committed Feb 24, 2024
1 parent 7c2d39f commit 26e760e
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions app/Jobs/UpdateMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ public function handle()
'Authorization' => $token,
])->withUserAgent('VATSIMUK')->get($url);

$response->throwIfStatus(404);
if ($response->status() === 404) {
Log::info("Member {$this->accountID} not found in VATSIM API. Deleting.");
$member->delete();

return;
}

$response = $response->json();

Expand All @@ -97,20 +102,6 @@ public function handle()
'pilottime' => (string) 0,
'cid' => $response['id'],
];
} catch (RequestException $e) {
if ($e->response->status() === 404) {
Log::info("Member {$this->accountID} not found in VATSIM API. Deleting.");
$member->delete();

return;
}

Bugsnag::notifyException($e, function ($report) {
$report->setSeverity('error');
$report->setMetaData([
'accountID' => $this->accountID,
]);
});
} catch (\Exception $e) {
Bugsnag::notifyException($e, function ($report) {
$report->setSeverity('error');
Expand Down

0 comments on commit 26e760e

Please sign in to comment.