From bc3e8305213e919ef484c337465c3ba55c6bad1a Mon Sep 17 00:00:00 2001 From: yemkareems Date: Mon, 29 Apr 2024 15:38:23 +0530 Subject: [PATCH] fix: added exception while logging error Signed-off-by: yemkareems --- apps/admin_audit/lib/Actions/Files.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/apps/admin_audit/lib/Actions/Files.php b/apps/admin_audit/lib/Actions/Files.php index e5bfe8737618b..fd2ef8b0ee00f 100644 --- a/apps/admin_audit/lib/Actions/Files.php +++ b/apps/admin_audit/lib/Actions/Files.php @@ -37,8 +37,6 @@ use OCP\Files\InvalidPathException; use OCP\Files\NotFoundException; use OCP\Preview\BeforePreviewFetchedEvent; -use Psr\Container\ContainerExceptionInterface; -use Psr\Container\NotFoundExceptionInterface; use Psr\Log\LoggerInterface; /** @@ -60,7 +58,7 @@ public function read(BeforeNodeReadEvent $event): void { ]; } catch (InvalidPathException|NotFoundException $e) { \OCP\Server::get(LoggerInterface::class)->error( - "Exception thrown in file read: ".$e->getMessage(), ['app' => 'admin_audit'] + "Exception thrown in file read: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] ); return; } @@ -87,7 +85,7 @@ public function rename(NodeRenamedEvent $event): void { ]; } catch (InvalidPathException|NotFoundException $e) { \OCP\Server::get(LoggerInterface::class)->error( - "Exception thrown in file rename: ".$e->getMessage(), ['app' => 'admin_audit'] + "Exception thrown in file rename: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] ); return; } @@ -112,7 +110,7 @@ public function create(NodeCreatedEvent $event): void { ]; } catch (InvalidPathException|NotFoundException $e) { \OCP\Server::get(LoggerInterface::class)->error( - "Exception thrown in file create: ".$e->getMessage(), ['app' => 'admin_audit'] + "Exception thrown in file create: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] ); return; } @@ -141,7 +139,7 @@ public function copy(NodeCopiedEvent $event): void { ]; } catch (InvalidPathException|NotFoundException $e) { \OCP\Server::get(LoggerInterface::class)->error( - "Exception thrown in file copy: ".$e->getMessage(), ['app' => 'admin_audit'] + "Exception thrown in file copy: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] ); return; } @@ -165,7 +163,7 @@ public function write(BeforeNodeWrittenEvent $event): void { ]; } catch (InvalidPathException|NotFoundException $e) { \OCP\Server::get(LoggerInterface::class)->error( - "Exception thrown in file write: ".$e->getMessage(), ['app' => 'admin_audit'] + "Exception thrown in file write: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] ); return; } @@ -193,7 +191,7 @@ public function update(NodeWrittenEvent $event): void { ]; } catch (InvalidPathException|NotFoundException $e) { \OCP\Server::get(LoggerInterface::class)->error( - "Exception thrown in file update: ".$e->getMessage(), ['app' => 'admin_audit'] + "Exception thrown in file update: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] ); return; } @@ -217,7 +215,7 @@ public function delete(NodeDeletedEvent $event): void { ]; } catch (InvalidPathException|NotFoundException $e) { \OCP\Server::get(LoggerInterface::class)->error( - "Exception thrown in file delete: ".$e->getMessage(), ['app' => 'admin_audit'] + "Exception thrown in file delete: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] ); return; } @@ -246,7 +244,7 @@ public function preview(BeforePreviewFetchedEvent $event): void { ]; } catch (InvalidPathException|NotFoundException $e) { \OCP\Server::get(LoggerInterface::class)->error( - "Exception thrown in file preview: ".$e->getMessage(), ['app' => 'admin_audit'] + "Exception thrown in file preview: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] ); return; }