Skip to content

Commit

Permalink
fix: added exception while logging error
Browse files Browse the repository at this point in the history
Signed-off-by: yemkareems <yemkareems@gmail.com>
  • Loading branch information
yemkareems committed Apr 29, 2024
1 parent 8b20a5f commit bc3e830
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions apps/admin_audit/lib/Actions/Files.php
Expand Up @@ -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;

/**
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit bc3e830

Please sign in to comment.