Use source maps if extension ships one for error stack trace formatting
In the [Julia extension]() we have crash reporting setup, so that we send a crash report whenever an exception occurs in our extension. We also bundle our extension with webpack. One problem is that the stack traces in the exceptions (if something goes wrong) are essentially useless, as they refer to locations in the bundled version of the extension, i.e. everything on line 1 :) We do actually ship a source map file in the extension, but the information in there doesn't show up in the exception objects. I think there are broadly speaking two ways to improve the situation: 1) run the extension host with the `--enable-source-maps` flag (but note that any custom `Error.prepareStackTrace` handler is then disabled, or 2) modify the already existing `Error.prepareStackTrace` handler in the extension host https://github.com/microsoft/vscode/blob/32b031eeefc4fd27a21659d35070967bfe965bcc/src/vs/workbench/api/common/extensionHostMain.ts#L92 to apply source map information if it is there. I am experimenting with that at the moment by using the https://www.npmjs.com/package/source-map-support package in our extension. That actually _does_ lead to error objects that have stack traces that use the source map information, so that is great. The drawback, though, is that by using this package I think we are overriding the default VS Code `Error.prepareStackTrace` handler that gets set [here](https://github.com/microsoft/vscode/blob/32b031eeefc4fd27a21659d35070967bfe965bcc/src/vs/workbench/a
Posted by davidanthoff on Mar 20, 2022, 1:30 AM
Tags
Related issues
- [BUG] Cowork (Windows): all Plan9 shares fail with "Plan9 mount failed: invalid argument" after Windows update KB5124008 (26200.9445) — uninstalling the KB fixe
- Feature Request: Auto-resume CLI session when usage limit resets
- Please deobfuscate the Python
- [Bug] MLX version of Gemma 4 26B fails to load: "Model type gemma4 not supported" (macOS)
- # 233 Developers Discussed Abandoning the Office Add-in Platform — An Open Letter on the Office.js Stability, Security & Trust Crisis
- [FEATURE] Allow users to configure which shell the Bash tool uses or inherit initial shell
Raise real-world problems, find people facing the same issue, and discuss solutions.2,500 issues0 comments
reliability (Software)
[BUG] Cowork (Windows): all Plan9 shares fail with "Plan9 mount failed: invalid argument" after Windows update KB5124008 (26200.9445) — uninstalling the KB fixe
Feature Request: Auto-resume CLI session when usage limit resets
Please deobfuscate the Python
[Bug] MLX version of Gemma 4 26B fails to load: "Model type gemma4 not supported" (macOS)
# 233 Developers Discussed Abandoning the Office Add-in Platform — An Open Letter on the Office.js Stability, Security & Trust Crisis
[FEATURE] Allow users to configure which shell the Bash tool uses or inherit initial shell
Admin Materials and Surfaces
AMD Support
Use source maps if extension ships one for error stack trace formatting
In the [Julia extension]() we have crash reporting setup, so that we send a crash report whenever an exception occurs in our extension. We also bundle our extension with webpack. One problem is that the stack traces in the exceptions (if something goes wrong) are essentially useless, as they refer to locations in the bundled version of the extension, i.e. everything on line 1 :) We do actually ship a source map file in the extension, but the information in there doesn't show up in the exception objects. I think there are broadly speaking two ways to improve the situation: 1) run the extension host with the `--enable-source-maps` flag (but note that any custom `Error.prepareStackTrace` handler is then disabled, or 2) modify the already existing `Error.prepareStackTrace` handler in the extension host https://github.com/microsoft/vscode/blob/32b031eeefc4fd27a21659d35070967bfe965bcc/src/vs/workbench/api/common/extensionHostMain.ts#L92 to apply source map information if it is there. I am experimenting with that at the moment by using the https://www.npmjs.com/package/source-map-support package in our extension. That actually _does_ lead to error objects that have stack traces that use the source map information, so that is great. The drawback, though, is that by using this package I think we are overriding the default VS Code `Error.prepareStackTrace` handler that gets set [here](https://github.com/microsoft/vscode/blob/32b031eeefc4fd27a21659d35070967bfe965bcc/src/vs/workbench/a
Comments (0)
No comments yet. Start the discussion.