mirror of
https://github.com/withastro/astro.git
synced 2025-01-06 22:10:10 -05:00
Remove telemetry for unhandled errors (#9571)
This commit is contained in:
parent
f192fc3a35
commit
ec71f03cfd
2 changed files with 10 additions and 2 deletions
5
.changeset/few-days-relate.md
Normal file
5
.changeset/few-days-relate.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"astro": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Removes telemetry for unhandled errors in the dev server
|
|
@ -3,7 +3,7 @@ import type { AstroConfig } from '../@types/astro.js';
|
||||||
import type DevPipeline from './devPipeline.js';
|
import type DevPipeline from './devPipeline.js';
|
||||||
|
|
||||||
import { collectErrorMetadata } from '../core/errors/dev/index.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 { formatErrorMessage } from '../core/messages.js';
|
||||||
import { eventError, telemetry } from '../events/index.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
|
// Our error should already be complete, but let's try to add a bit more through some guesswork
|
||||||
const errorWithMetadata = collectErrorMetadata(err, config.root);
|
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 }));
|
telemetry.record(eventError({ cmd: 'dev', err: errorWithMetadata, isFatal: false }));
|
||||||
|
}
|
||||||
|
|
||||||
pipeline.logger.error(
|
pipeline.logger.error(
|
||||||
null,
|
null,
|
||||||
|
|
Loading…
Reference in a new issue