Skip to content

Commit

Permalink
fixup! feat(dav): implement personal absence settings
Browse files Browse the repository at this point in the history
  • Loading branch information
st3iny committed Oct 27, 2023
1 parent a49ae2d commit 0956226
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/dav/lib/Settings/AvailabilitySettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

use OCA\DAV\AppInfo\Application;
use OCA\DAV\Db\AbsenceMapper;
use OCA\Mail\Vendor\Psr\Log\LoggerInterface;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
Expand All @@ -42,6 +43,7 @@ class AvailabilitySettings implements ISettings {
public function __construct(IConfig $config,
IInitialState $initialState,
?string $userId,
private LoggerInterface $logger,
private AbsenceMapper $absenceMapper) {
$this->config = $config;
$this->initialState = $initialState;
Expand All @@ -68,7 +70,13 @@ public function getForm(): TemplateResponse {
try {
$absence = $this->absenceMapper->findByUserId($this->userId);
$this->initialState->provideInitialState('absence', $absence);
} catch (DoesNotExistException|\OCP\DB\Exception) {
} catch (DoesNotExistException) {
// The user has not yet set up an absence period.
// Logging this error is not necessary.
} catch (\OCP\DB\Exception $e) {
$this->logger->error("Could not find absence data for user $this->userId: " . $e->getMessage(), [
'exception' => $e,
]);
}
}

Expand Down

0 comments on commit 0956226

Please sign in to comment.