Commit 04f0973
authored
The server load function for /devcard/[id] was fetching card data from
a hardcoded http://localhost:3000 URL, causing the route to fail silently
in all non-local environments (staging, production, Docker).
Replace the hardcoded URL with the BACKEND_URL environment variable,
falling back to http://localhost:3000 for local development. This matches
the existing pattern used by the /u/[username] route.
Also improve error handling: wrap the fetch in a try/catch to handle
network-level failures with a proper 500 response, distinguish 404 (card
not found) from other backend errors, and re-throw SvelteKit HttpError
objects so they are not swallowed by the catch block.
1 parent c122569 commit 04f0973
1 file changed
Lines changed: 19 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | | - | |
8 | | - | |
9 | | - | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | | - | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | | - | |
16 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
17 | 28 | | |
0 commit comments