0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

Remove telemetry for unhandled errors (#9571)

This commit is contained in:
Bjorn Lu 2024-01-02 22:14:09 +07:00 committed by GitHub
parent f192fc3a35
commit ec71f03cfd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
"astro": patch
---
Removes telemetry for unhandled errors in the dev server

View file

@ -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';
@ -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);
// 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,