From 6ea959f10039b5b1a79ca5e68eb0a5926f7ae257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 29 Jun 2021 15:21:22 +0200 Subject: [PATCH] Log exceptions that happen on unknown exception and return generic error messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/Service/ApiService.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Service/ApiService.php b/lib/Service/ApiService.php index 5691734ff5b..faa4c879e06 100644 --- a/lib/Service/ApiService.php +++ b/lib/Service/ApiService.php @@ -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); @@ -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); }