Skip to content

Commit b6ec2df

Browse files
committed
Add PhotoSwipe dependency and fix PhotoGallery error handling
- Install photoswipe@^5.4.4 (missing in previous commit) - Fix TypeScript error: properly handle unknown error type in catch block
1 parent 98dbe2a commit b6ec2df

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

bun.lock

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
"@tailwindcss/vite": "^4.1.16",
88
"@types/bun": "latest",
99
"@types/headroom": "^0.12.4",
10+
"@types/sharp": "^0.32.0",
1011
"astro": "^5.15.1",
1112
"class-variance-authority": "^0.7.1",
1213
"clsx": "^2.1.1",
1314
"playwright": "^1.56.1",
15+
"sharp": "^0.34.4",
1416
"tailwindcss": "^4.1.16",
1517
"typescript": "^5"
1618
},
@@ -31,6 +33,8 @@
3133
"astro-mermaid": "^1.1.0",
3234
"headroom.js": "^0.12.0",
3335
"motion": "^12.23.24",
34-
"shiki": "^3.13.0"
36+
"photoswipe": "^5.4.4",
37+
"shiki": "^3.13.0",
38+
"zod": "^4.1.12"
3539
}
3640
}

src/components/PhotoGallery.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ let photos;
5454
try {
5555
photos = validatePhotos(rawPhotos);
5656
} catch (error) {
57+
const message = error instanceof Error ? error.message : String(error);
5758
throw new Error(
58-
`PhotoGallery: Invalid photo data\n${error.message}\n` +
59+
`PhotoGallery: Invalid photo data\n${message}\n` +
5960
`Check your JSON file for schema violations (src, alt, caption, width, height)`,
6061
);
6162
}

0 commit comments

Comments
 (0)