Skip to content

Commit

Permalink
Remove unnecessary if
Browse files Browse the repository at this point in the history
  • Loading branch information
javier-villatoro committed Aug 6, 2024
1 parent 4febdc6 commit 477ba15
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Http/Client/LeverClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,18 +480,14 @@ private function handleException(Exception $e, string $method, string $endpoint,
'response' => null,
];

if (! empty($options)) {
$logDetails['options'] = json_encode($options);
}

if ($e instanceof ClientException) {
$logDetails['response'] = $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null;
}

Log::error("HTTP Error in $method: ".$e->getMessage(), $logDetails);
Log::error("HTTP $method error: ".$e->getMessage(), $logDetails);

$type = $e instanceof ClientException ? 'ClientException' : 'Exception';

throw new LeverClientException("$type error executing HTTP request in $method. Please check the logs for more details.");
throw new LeverClientException("$type error executing HTTP $method. Please check the logs for more details.");
}
}

0 comments on commit 477ba15

Please sign in to comment.