@slopmachine/svelte 0.1.20 → 0.1.21
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 +1 -1
- package/src/SlopImage.svelte +7 -4
- package/src/SlopText.svelte +11 -2
- package/src/SlopVideo.svelte +7 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slopmachine/svelte",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
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",
|
package/src/SlopImage.svelte
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
/>
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
@version 0.1.
|
|
18
|
+
@version 0.1.21
|
|
19
19
|
-->
|
|
20
20
|
<script lang="ts">
|
|
21
21
|
import {
|
|
@@ -108,18 +108,21 @@
|
|
|
108
108
|
fetch(src, { method: "HEAD", signal: abortController.signal })
|
|
109
109
|
.then(async (res) => {
|
|
110
110
|
if (!res.ok) {
|
|
111
|
-
|
|
111
|
+
let errorMessage = res.statusText;
|
|
112
112
|
try {
|
|
113
113
|
const errRes = await fetch(src, {
|
|
114
114
|
signal: abortController.signal,
|
|
115
115
|
});
|
|
116
|
-
const
|
|
117
|
-
|
|
116
|
+
const errorData = await errRes.json();
|
|
117
|
+
if (errorData.error) {
|
|
118
|
+
errorMessage = errorData.error;
|
|
119
|
+
}
|
|
118
120
|
} catch (e: any) {
|
|
119
121
|
if (e.name !== "AbortError") {
|
|
120
122
|
// Failed to fetch or parse error details
|
|
121
123
|
}
|
|
122
124
|
}
|
|
125
|
+
console.error("SlopImage error:", res.status, errorMessage);
|
|
123
126
|
isLoading = false;
|
|
124
127
|
}
|
|
125
128
|
})
|
package/src/SlopText.svelte
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* </SlopText>
|
|
24
24
|
* ```
|
|
25
25
|
*
|
|
26
|
-
* @version 0.1.
|
|
26
|
+
* @version 0.1.21
|
|
27
27
|
*/
|
|
28
28
|
interface Props {
|
|
29
29
|
// SlopTextOptions
|
|
@@ -76,7 +76,16 @@
|
|
|
76
76
|
|
|
77
77
|
const response = await fetch(url);
|
|
78
78
|
if (!response.ok) {
|
|
79
|
-
|
|
79
|
+
let errorMessage = response.statusText;
|
|
80
|
+
try {
|
|
81
|
+
const errorData = await response.json();
|
|
82
|
+
if (errorData.error) {
|
|
83
|
+
errorMessage = errorData.error;
|
|
84
|
+
}
|
|
85
|
+
} catch (e) {
|
|
86
|
+
// Ignore JSON parse errors if the response isn't JSON
|
|
87
|
+
}
|
|
88
|
+
throw new Error(`Failed to fetch text: ${errorMessage}`);
|
|
80
89
|
}
|
|
81
90
|
const content = await response.text();
|
|
82
91
|
if (isMounted) {
|
package/src/SlopVideo.svelte
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
/>
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
@version 0.1.
|
|
21
|
+
@version 0.1.21
|
|
22
22
|
-->
|
|
23
23
|
<script lang="ts">
|
|
24
24
|
import {
|
|
@@ -112,17 +112,21 @@
|
|
|
112
112
|
fetch(src, { method: "HEAD", signal: abortController.signal })
|
|
113
113
|
.then(async (res) => {
|
|
114
114
|
if (!res.ok) {
|
|
115
|
+
let errorMessage = res.statusText;
|
|
115
116
|
try {
|
|
116
117
|
const errRes = await fetch(src, {
|
|
117
118
|
signal: abortController.signal,
|
|
118
119
|
});
|
|
119
|
-
const
|
|
120
|
-
|
|
120
|
+
const errorData = await errRes.json();
|
|
121
|
+
if (errorData.error) {
|
|
122
|
+
errorMessage = errorData.error;
|
|
123
|
+
}
|
|
121
124
|
} catch (e: any) {
|
|
122
125
|
if (e.name !== "AbortError") {
|
|
123
126
|
// Failed to fetch or parse error details
|
|
124
127
|
}
|
|
125
128
|
}
|
|
129
|
+
console.error("SlopVideo error:", res.status, errorMessage);
|
|
126
130
|
isLoading = false;
|
|
127
131
|
}
|
|
128
132
|
})
|