Skip to content

Commit

Permalink
fix: add error label to error toasts
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaclen committed Oct 19, 2024
1 parent bb94670 commit 0f7f349
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
5 changes: 2 additions & 3 deletions src/routes/sessions/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,10 @@
function handleError(error: Error) {
if (error.message === 'Failed to fetch') {
toast.error($LL.cantConnectToOllamaServer());
toast.error($LL.error(), { description: $LL.cantConnectToOllamaServer() });
} else {
toast.error($LL.genericError({ error: error.toString() }));
toast.error($LL.error(), { description: $LL.genericError({ error: error.toString() }) });
}
stopCompletion();
}
Expand Down
16 changes: 7 additions & 9 deletions src/routes/settings/Ollama.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,13 @@
} catch (error) {
const typedError = error instanceof Error ? error : new Error(String(error));
toast.error(
typedError.message === 'Failed to fetch'
? $LL.couldntConnectToOllamaServer()
: typedError.message,
{
id: toastId,
description: ''
}
);
toast.error($LL.error(), {
id: toastId,
description:
typedError.message === 'Failed to fetch'
? $LL.couldntConnectToOllamaServer()
: typedError.message
});
ollamaTagResponse = null;
$settingsStore.ollamaServerStatus = 'disconnected';
}
Expand Down

0 comments on commit 0f7f349

Please sign in to comment.