Skip to content

Commit 7745aa8

Browse files
authored
fix(nuxt): ignore 300-400 status codes on app errors in Nuxt
1 parent 14667ee commit 7745aa8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/nuxt/src/runtime/plugins/sentry.client.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { GLOBAL_OBJ, getClient } from '@sentry/core';
22
import { browserTracingIntegration, vueIntegration } from '@sentry/vue';
3-
import { defineNuxtPlugin } from 'nuxt/app';
3+
import { defineNuxtPlugin, isNuxtError } from 'nuxt/app';
44
import type { GlobalObjWithIntegrationOptions } from '../../client/vueIntegration';
55
import { reportNuxtError } from '../utils';
66

@@ -66,6 +66,13 @@ export default defineNuxtPlugin({
6666
});
6767

6868
nuxtApp.hook('app:error', error => {
69+
// Do not handle 404 and 422
70+
if (isNuxtError(error)) {
71+
// Do not report if status code is 3xx or 4xx
72+
if (error.statusCode >= 300 && error.statusCode < 500) {
73+
return;
74+
}
75+
}
6976
reportNuxtError({ error });
7077
});
7178

0 commit comments

Comments
 (0)