@slopmachine/svelte 0.1.21 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slopmachine/svelte",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "llms": "https://slopmachine-dev.github.io/slopmachine-sdk/llms.txt",
5
5
  "llmsFull": "https://slopmachine-dev.github.io/slopmachine-sdk/llms-full.txt",
6
6
  "description": "The official Svelte SDK for Slop Machine",
@@ -15,7 +15,7 @@
15
15
  />
16
16
  ```
17
17
 
18
- @version 0.1.21
18
+ @version 0.1.22
19
19
  -->
20
20
  <script lang="ts">
21
21
  import {
@@ -113,7 +113,8 @@
113
113
  const errRes = await fetch(src, {
114
114
  signal: abortController.signal,
115
115
  });
116
- const errorData = await errRes.json();
116
+ const errorText = await errRes.text();
117
+ const errorData = JSON.parse(errorText);
117
118
  if (errorData.error) {
118
119
  errorMessage = errorData.error;
119
120
  }
@@ -23,7 +23,7 @@
23
23
  * </SlopText>
24
24
  * ```
25
25
  *
26
- * @version 0.1.21
26
+ * @version 0.1.22
27
27
  */
28
28
  interface Props {
29
29
  // SlopTextOptions
@@ -78,7 +78,8 @@
78
78
  if (!response.ok) {
79
79
  let errorMessage = response.statusText;
80
80
  try {
81
- const errorData = await response.json();
81
+ const errorText = await response.text();
82
+ const errorData = JSON.parse(errorText);
82
83
  if (errorData.error) {
83
84
  errorMessage = errorData.error;
84
85
  }
@@ -93,8 +94,10 @@
93
94
  }
94
95
  } catch (err) {
95
96
  if (isMounted) {
96
- error =
97
+ const finalError =
97
98
  err instanceof Error ? err : new Error("Failed to generate text");
99
+ console.error(finalError);
100
+ error = finalError;
98
101
  }
99
102
  } finally {
100
103
  if (isMounted) {
@@ -18,7 +18,7 @@
18
18
  />
19
19
  ```
20
20
 
21
- @version 0.1.21
21
+ @version 0.1.22
22
22
  -->
23
23
  <script lang="ts">
24
24
  import {
@@ -117,7 +117,8 @@
117
117
  const errRes = await fetch(src, {
118
118
  signal: abortController.signal,
119
119
  });
120
- const errorData = await errRes.json();
120
+ const errorText = await errRes.text();
121
+ const errorData = JSON.parse(errorText);
121
122
  if (errorData.error) {
122
123
  errorMessage = errorData.error;
123
124
  }