Skip to content

Commit

Permalink
Merge pull request #1697 from nextcloud/backport/1695/stable21
Browse files Browse the repository at this point in the history
[stable21] Log exceptions that happen on unknown exception and return generic messages
  • Loading branch information
juliusknorr authored Jun 29, 2021
2 parents 639e2a7 + 6ea959f commit 086281f
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 @@ -95,7 +95,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 @@ -187,9 +188,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 086281f

Please sign in to comment.