yaml-language-server
yaml-language-server copied to clipboard
Send real errors to telemetry
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
Bonus tip: if you replace convertErrorToTelemetryMsg with Node.js’ builtin function util.inspect(), you get better error representations, including error causes.
coverage: 84.159% (-0.02%) from 84.174% when pulling 10dc8e64de2014e2546eb192b1ec53583df60903 on remcohaszing:telemetry-send-error into f039273ee5b6974db5ad34b03bb24cfe09b64447 on redhat-developer:main.