Skip to content

Commit e2bab88

Browse files
s1gr1dbitsandfoxes
authored andcommitted
docs(astro): Specify where to put the script tags (#14143)
## DESCRIBE YOUR PR Adds more context around where to put the JS code inside an Astro component. When the script is placed outside a `body` element, Sentry is not yet initialized. Came up in this PR: getsentry/sentry-javascript#16316 ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [ ] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs)
1 parent 52aed31 commit e2bab88

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
You can pass an `Error` object to `captureException()` to have it captured as an event. It's also possible to pass non-`Error` objects and strings, but be aware that the resulting events in Sentry may be missing a stack trace.
22

3-
```javascript
4-
import * as Sentry from "@sentry/astro";
3+
```html {filename:Component.astro}
4+
<!-- Make sure this script tag is placed at the top inside the <body> tag (for example, inside a Layout slot) -->
5+
<script>
6+
import * as Sentry from "@sentry/astro";
57
6-
try {
7-
aFunctionThatMightFail();
8-
} catch (err) {
9-
Sentry.captureException(err);
10-
}
8+
try {
9+
aFunctionThatMightFail();
10+
} catch (err) {
11+
Sentry.captureException(err);
12+
}
13+
</script>
1114
```
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
```javascript
2-
import * as Sentry from "@sentry/astro";
1+
```html {filename:Component.astro}
2+
<!-- Make sure this script tag is placed at the top inside the <body> tag (for example, inside a Layout slot) -->
3+
<script>
4+
import * as Sentry from "@sentry/astro";
5+
</script>
36
```

0 commit comments

Comments
 (0)