coyotte508 HF staff commited on
Commit
69830ae
1 Parent(s): a503e4d

🥅 Different errors (#144)

Browse files
src/routes/conversation/[id]/+page.svelte CHANGED
@@ -10,7 +10,7 @@
10
  import { PUBLIC_MAX_INPUT_TOKENS, PUBLIC_SEP_TOKEN } from "$env/static/public";
11
  import { shareConversation } from "$lib/shareConversation";
12
  import { UrlDependency } from "$lib/types/UrlDependency";
13
- import { error } from "$lib/stores/errors";
14
  import { randomUUID } from "$lib/utils/randomUuid";
15
 
16
  export let data;
@@ -141,8 +141,13 @@
141
  await invalidate(UrlDependency.ConversationList);
142
  }
143
  } catch (err) {
144
- // TODO: Should prob check if this is really a TooManyRequests error
145
- $error = "Too much traffic, please try again.";
 
 
 
 
 
146
  console.error(err);
147
  } finally {
148
  loading = false;
 
10
  import { PUBLIC_MAX_INPUT_TOKENS, PUBLIC_SEP_TOKEN } from "$env/static/public";
11
  import { shareConversation } from "$lib/shareConversation";
12
  import { UrlDependency } from "$lib/types/UrlDependency";
13
+ import { ERROR_MESSAGES, error } from "$lib/stores/errors";
14
  import { randomUUID } from "$lib/utils/randomUuid";
15
 
16
  export let data;
 
141
  await invalidate(UrlDependency.ConversationList);
142
  }
143
  } catch (err) {
144
+ if (err instanceof Error && err.message.includes("overloaded")) {
145
+ $error = "Too much traffic, please try again.";
146
+ } else if (err instanceof Error) {
147
+ $error = err.message;
148
+ } else {
149
+ $error = ERROR_MESSAGES.default;
150
+ }
151
  console.error(err);
152
  } finally {
153
  loading = false;