Skip to content

Commit

Permalink
Set up Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
Perlence committed Dec 4, 2024
1 parent 5eac016 commit 4d0d4fc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
11 changes: 11 additions & 0 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@
<script type="importmap">
{
"imports": {
"@sentry/browser": "/vendor/@[email protected]",
"alpinejs": "/vendor/[email protected]",
"autosize": "/vendor/[email protected]",
"scroll-lock": "/vendor/[email protected]",
"swiper": "/vendor/[email protected]",
"swiper/css": "/vendor/[email protected]",
"swiper/css/pagination": "/vendor/[email protected]",
"swiper/modules/pagination": "/vendor/[email protected]",
"/npm/": "https://cdn.jsdelivr.net/npm/"
{{- /* @sentry/browser loads some more modules from jsdelivr */}}
}
}
</script>
Expand Down Expand Up @@ -54,7 +57,15 @@
{{- end }}
{{ partial "footer.html" . }}
<script type="module">
import * as Sentry from '@sentry/browser';
import Alpine from 'alpinejs';

Sentry.init({
dsn: 'https://[email protected]'
+ '/4506218350641152',
environment: '{{ hugo.Environment }}',
});

Alpine.start();
</script>
</body>
Expand Down
6 changes: 5 additions & 1 deletion layouts/partials/contact-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
</div>

<script type="module">
import * as Sentry from '@sentry/browser';
import Alpine from "alpinejs";
import autosize from "autosize";

Expand Down Expand Up @@ -229,7 +230,10 @@
event.target.reset();
}
} catch (e) {
// TODO: Log the error to Sentry.
Sentry.withScope((scope) => {
scope.setExtra('form_data', data);
Sentry.captureException(e);
});
} finally {
this.submitting = false;
}
Expand Down
7 changes: 7 additions & 0 deletions static/vendor/@[email protected]

Large diffs are not rendered by default.

0 comments on commit 4d0d4fc

Please sign in to comment.