Skip to content

Commit

Permalink
Merge pull request #1698 from nextcloud/backport/1695/stable20
Browse files Browse the repository at this point in the history
[stable20] Log exceptions that happen on unknown exception and return generic messages
  • Loading branch information
juliushaertl committed Jun 29, 2021
2 parents 59e43bc + 28b718a commit 5dd3b8b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/Service/ApiService.php
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 5dd3b8b

Please sign in to comment.