Skip to content

Commit c2d4e92

Browse files
committed
Update test handling in Download class
1 parent 20c23d3 commit c2d4e92

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎src/components/CallToAction/Download/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ The component includes runtime validation:
171171

172172
```typescript
173173
if (!resource) {
174-
throw new Error('Download CTA component requires a "resource" prop')
174+
const message = 'Download CTA component requires a "resource" prop'
175+
throw new ClientScriptError({ message })
175176
}
176177
```
177178

‎src/components/CallToAction/Download/index.astro‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* ```
1717
*/
1818
19+
import { ClientScriptError } from '@components/scripts/errors'
20+
1921
export interface Props {
2022
/** Name of the download resource (matches the folder name in content/downloads) */
2123
resource: string
@@ -42,7 +44,8 @@ const {
4244
4345
// Validate that resource is provided
4446
if (!resource) {
45-
throw new Error('Download CTA component requires a "resource" prop')
47+
const message = 'Download CTA component requires a "resource" prop'
48+
throw new ClientScriptError({ message })
4649
}
4750
4851
// Construct the download landing page URL

0 commit comments

Comments
 (0)