yaml-language-server icon indicating copy to clipboard operation
yaml-language-server copied to clipboard

Send real errors to telemetry

Open remcohaszing opened this issue 1 year ago • 2 comments

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

remcohaszing avatar Jul 07 '24 12:07 remcohaszing

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

remcohaszing avatar Jul 07 '24 12:07 remcohaszing

Coverage Status

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

coveralls avatar Jul 07 '24 12:07 coveralls

Coverage Status

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

coveralls avatar Feb 06 '25 11:02 coveralls