Skip to content

Commit

Permalink
Log exceptions that happen on unknown exception and return generic er…
Browse files Browse the repository at this point in the history
…ror messages

Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr authored and backportbot[bot] committed Jun 29, 2021
1 parent b0a082f commit c617f89
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/Service/ApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ public function create($fileId = null, $filePath = null, $token = null, $guestNa

$document = $this->documentService->createDocument($file);
} catch (Exception $e) {
return new DataResponse($e->getMessage(), 500);
$this->logger->logException($e);
return new DataResponse('Failed to create the document session', 500);
}

$session = $this->sessionService->initSession($document->getId(), $guestName);
Expand Down Expand Up @@ -194,9 +195,9 @@ public function sync($documentId, $sessionId, $sessionToken, $version = 0, $auto
} catch (NotFoundException $e) {
return new DataResponse([], 404);
} catch (Exception $e) {
$this->logger->logException($e, ['level' => ILogger::INFO]);
$this->logger->logException($e);
return new DataResponse([
'message' => $e->getMessage()
'message' => 'Failed to autosave document'
], 500);
}

Expand Down

0 comments on commit c617f89

Please sign in to comment.