Skip to content

Commit

Permalink
Remove telemetry for unhandled errors (#9571)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy authored Jan 2, 2024
1 parent f192fc3 commit ec71f03
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/few-days-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Removes telemetry for unhandled errors in the dev server
7 changes: 5 additions & 2 deletions packages/astro/src/vite-plugin-astro-server/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { AstroConfig } from '../@types/astro.js';
import type DevPipeline from './devPipeline.js';

import { collectErrorMetadata } from '../core/errors/dev/index.js';
import { createSafeError } from '../core/errors/index.js';
import { createSafeError, AstroErrorData } from '../core/errors/index.js';
import { formatErrorMessage } from '../core/messages.js';
import { eventError, telemetry } from '../events/index.js';

Expand All @@ -24,7 +24,10 @@ export function recordServerError(
// Our error should already be complete, but let's try to add a bit more through some guesswork
const errorWithMetadata = collectErrorMetadata(err, config.root);

telemetry.record(eventError({ cmd: 'dev', err: errorWithMetadata, isFatal: false }));
// Ignore unhandled rejection errors as they appear A LOT and we cannot record the amount to telemetry
if (errorWithMetadata.name !== AstroErrorData.UnhandledRejection.name) {
telemetry.record(eventError({ cmd: 'dev', err: errorWithMetadata, isFatal: false }));
}

pipeline.logger.error(
null,
Expand Down

0 comments on commit ec71f03

Please sign in to comment.