File size: 585 Bytes
6e41657
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<script setup>
import * as Sentry from '@sentry/nuxt';
import { request } from '#shared/utils/request.ts';

function triggerClientError() {
  throw new Error('Nuxt Button Error');
}
function getSentryData() {
  Sentry.startSpan(
    {
      name: 'Example Frontend Span',
      op: 'test',
    },
    async () => {
      await request('/api/sentry-example');
    }
  );
}
</script>

<template>
  <button id="errorBtn" @click="triggerClientError">Throw Client Error</button>
  <button type="button" @click="getSentryData">Throw Server Error</button>
</template>