coyotte508 HF staff commited on
Commit
34857c4
1 Parent(s): 0714764

🥅 Display more errors (#90)

Browse files
src/lib/shareConversation.ts CHANGED
@@ -27,6 +27,6 @@ export async function shareConversation(id: string, title: string) {
27
  }
28
  } catch (err) {
29
  console.error(err);
30
- alert("Error while sharing conversation: " + err);
31
  }
32
  }
 
27
  }
28
  } catch (err) {
29
  console.error(err);
30
+ alert(String(err));
31
  }
32
  }
src/routes/+layout.svelte CHANGED
@@ -35,7 +35,7 @@
35
  }
36
  } catch (err) {
37
  console.error(err);
38
- alert("Error while deleting conversation: " + err);
39
  }
40
  }
41
  </script>
 
35
  }
36
  } catch (err) {
37
  console.error(err);
38
+ alert(String(err));
39
  }
40
  }
41
  </script>
src/routes/+page.svelte CHANGED
@@ -1,8 +1,8 @@
1
  <script lang="ts">
2
- import { goto } from "$app/navigation";
3
- import { base } from "$app/paths";
4
- import ChatWindow from "$lib/components/chat/ChatWindow.svelte";
5
- import { pendingMessage } from "$lib/stores/pendingMessage";
6
 
7
  let loading = false;
8
 
@@ -10,14 +10,14 @@
10
  try {
11
  loading = true;
12
  const res = await fetch(`${base}/conversation`, {
13
- method: "POST",
14
  headers: {
15
- "Content-Type": "application/json",
16
- },
17
  });
18
 
19
  if (!res.ok) {
20
- alert("Error while creating conversation: " + (await res.text()));
21
  return;
22
  }
23
 
@@ -28,6 +28,8 @@
28
 
29
  // invalidateAll to update list of conversations
30
  await goto(`${base}/conversation/${conversationId}`, { invalidateAll: true });
 
 
31
  } finally {
32
  loading = false;
33
  }
 
1
  <script lang="ts">
2
+ import { goto } from '$app/navigation';
3
+ import { base } from '$app/paths';
4
+ import ChatWindow from '$lib/components/chat/ChatWindow.svelte';
5
+ import { pendingMessage } from '$lib/stores/pendingMessage';
6
 
7
  let loading = false;
8
 
 
10
  try {
11
  loading = true;
12
  const res = await fetch(`${base}/conversation`, {
13
+ method: 'POST',
14
  headers: {
15
+ 'Content-Type': 'application/json'
16
+ }
17
  });
18
 
19
  if (!res.ok) {
20
+ alert('Error while creating conversation: ' + (await res.text()));
21
  return;
22
  }
23
 
 
28
 
29
  // invalidateAll to update list of conversations
30
  await goto(`${base}/conversation/${conversationId}`, { invalidateAll: true });
31
+ } catch (err) {
32
+ alert(String(err));
33
  } finally {
34
  loading = false;
35
  }
src/routes/conversation/[id]/+page.svelte CHANGED
@@ -109,6 +109,9 @@
109
  } else {
110
  await invalidate(UrlDependency.ConversationList);
111
  }
 
 
 
112
  } finally {
113
  loading = false;
114
  }
 
109
  } else {
110
  await invalidate(UrlDependency.ConversationList);
111
  }
112
+ } catch (err) {
113
+ console.error(err);
114
+ alert(String(err));
115
  } finally {
116
  loading = false;
117
  }
src/routes/r/[id]/+page.svelte CHANGED
@@ -35,6 +35,8 @@
35
 
36
  // invalidateAll to update list of conversations
37
  await goto(`${base}/conversation/${conversationId}`, { invalidateAll: true });
 
 
38
  } finally {
39
  loading = false;
40
  }
 
35
 
36
  // invalidateAll to update list of conversations
37
  await goto(`${base}/conversation/${conversationId}`, { invalidateAll: true });
38
+ } catch (err) {
39
+ alert(String(err));
40
  } finally {
41
  loading = false;
42
  }