Skip to content

Commit

Permalink
Fix error handling and logging
Browse files Browse the repository at this point in the history
Signed-off-by: MB-Finski <[email protected]>
  • Loading branch information
MB-Finski committed Jan 30, 2024
1 parent d0e4210 commit 9b67447
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Service/AssistantService.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use Parsedown;
use PhpOffice\PhpWord\IOFactory;
use Psr\Log\LoggerInterface;
use RuntimeException;

class AssistantService {

Expand Down Expand Up @@ -169,8 +170,10 @@ public function getTextProcessingTask(?string $userId, int $taskId): ?Task {
}
} catch (NotFoundException $e) {
// Ocp task not found, so we can't update the status
} catch (\Exception | \Throwable $e) {
$this->logger->debug('OCP task not found for assistant task ' . $task->getId() . '. Could not update status.');
} catch (\InvalidArgumentException | \OCP\Db\Exception | RuntimeException $e) {
// Something else went wrong, so we can't update the status
$this->logger->warning('Unknown error while trying to retreive an updated status for assistant task: ' . $task->getId() . '.', ['exception' => $e]);
}

return $task;
Expand Down

0 comments on commit 9b67447

Please sign in to comment.