]> source.dussan.org Git - nextcloud-server.git/commitdiff
LLM OCP API: Don't lose trace of wrapped exceptions
authorMarcel Klehr <mklehr@gmx.net>
Fri, 7 Jul 2023 09:44:35 +0000 (11:44 +0200)
committerMarcel Klehr <mklehr@gmx.net>
Wed, 9 Aug 2023 08:02:05 +0000 (10:02 +0200)
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
(cherry picked from commit 05fcf319872988c4cf24e8a98c7611f0356565d5)

lib/private/LanguageModel/LanguageModelManager.php

index c6f1a17229440aee9e1c0a356c7ced0fcff87a82..c195669acb433aaaa21065cca8bddd4dba19f469 100644 (file)
@@ -168,11 +168,11 @@ class LanguageModelManager implements ILanguageModelManager {
                                $this->logger->info('LanguageModel call using provider ' . $provider->getName() . ' failed', ['exception' => $e]);
                                $task->setStatus(ILanguageModelTask::STATUS_FAILED);
                                $this->taskMapper->update(Task::fromLanguageModelTask($task));
-                               throw new RuntimeException('LanguageModel call using provider ' . $provider->getName() . ' failed: ' . $e->getMessage());
+                               throw new RuntimeException('LanguageModel call using provider ' . $provider->getName() . ' failed: ' . $e->getMessage(), 0, $e);
                        }
                }
 
-               throw new RuntimeException('Could not transcribe file');
+               throw new RuntimeException('Could not run task');
        }
 
        /**
@@ -205,9 +205,9 @@ class LanguageModelManager implements ILanguageModelManager {
                } catch (DoesNotExistException $e) {
                        throw new NotFoundException('Could not find task with the provided id');
                } catch (MultipleObjectsReturnedException $e) {
-                       throw new RuntimeException('Could not uniquely identify task with given id');
+                       throw new RuntimeException('Could not uniquely identify task with given id', 0, $e);
                } catch (Exception $e) {
-                       throw new RuntimeException('Failure while trying to find task by id: '.$e->getMessage());
+                       throw new RuntimeException('Failure while trying to find task by id: '.$e->getMessage(), 0, $e);
                }
        }
 }