Skip to content

Commit

Permalink
log(requests): set original exception as previous
Browse files Browse the repository at this point in the history
Also log requests that do not get a response.

Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Sep 15, 2023
1 parent 0636374 commit 2fa1078
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/Tools/Traits/TNCRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,19 @@ public function doRequest(NCRequest $request, bool $exceptionOnIssue = true): vo
} catch (ClientException $e) {
$request->setResult(new NCRequestResult(null, $e));
} catch (Exception $e) {
$this->exception($e, self::$DEBUG, ['request' => $request]);
$this->e($e, ['request' => $request]);
}
}

$this->debug('doRequest done', ['request' => $request]);

if ($exceptionOnIssue && (!$request->hasResult() || $request->getResult()->hasException())) {
throw new RequestNetworkException();
if ($exceptionOnIssue) {
if (!$request->hasResult()) {
throw new RequestNetworkException('Request failed without result.');
}
elseif ($request->getResult()->hasException())) {
throw new RequestNetworkException('Request failed.', 0, $request->getResult()->getException());
}
}
}

Expand Down

0 comments on commit 2fa1078

Please sign in to comment.