Skip to content

Send real errors to telemetry#981

Merged
msivasubramaniaan merged 2 commits intoredhat-developer:mainfrom
remcohaszing:telemetry-send-error
Feb 6, 2025
Merged

Send real errors to telemetry#981
msivasubramaniaan merged 2 commits intoredhat-developer:mainfrom
remcohaszing:telemetry-send-error

Conversation

@remcohaszing
Copy link
Contributor

What does this PR do?

Every call to telemetry.sendError contained the same boilerplate code to create an object with the property error, which contains a string representation of the real error. This change moves this conversion into the Telemetry implementation. This reduces the need for boilerplate code in other places.

What issues does this PR fix or reference?

This change also affects monaco-yaml. Because the telemetry now resolves the real error, the browser can log the error to the console with a better stack trace.

Is it tested? How?

npm test

Every call to `telemetry.sendError` contained the same boilerplate code
to create an object with the property `error`, which contains a string
representation of the real error. This change moves this conversion into
the `Telemetry` implementation. This reduces the need for boilerplate
code in other places.

This change also affects `monaco-yaml`. Because the telemetry now
resolves the real error, the browser can log the error to the console
with a better stack trace.
@remcohaszing
Copy link
Contributor Author

Bonus tip: if you replace convertErrorToTelemetryMsg with Node.js’ builtin function util.inspect(), you get better error representations, including error causes.

@coveralls
Copy link

Coverage Status

coverage: 84.159% (-0.02%) from 84.174%
when pulling 10dc8e6 on remcohaszing:telemetry-send-error
into f039273 on redhat-developer:main.

@coveralls
Copy link

Coverage Status

coverage: 84.225% (-0.02%) from 84.24%
when pulling f340d29 on remcohaszing:telemetry-send-error
into 8083f46 on redhat-developer:main.

Copy link
Contributor

@msivasubramaniaan msivasubramaniaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@msivasubramaniaan msivasubramaniaan merged commit 69ba394 into redhat-developer:main Feb 6, 2025
4 checks passed
@remcohaszing remcohaszing deleted the telemetry-send-error branch February 6, 2025 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants