proposal-error-stacks: Option to forge an error's stack trace
It’d be useful for error reporting to be able to forge an error’s stack trace, for cases like:
- Serializing errors across thread/process boundaries (HTML’s spec could add error serialization to their structured clone algorithm)
- Sanitizing a stack trace for security reasons (for example, Caja)
- Language VMs like Ember’s Glimmer or Moonshine could have a dev mode that provides better stack traces to JS than what you’d get otherwise (a lot of hardly-useful internal calls)
Currently, no engine provides this facility, but V8 does support a restricted form via Error.captureStackTrace, but it’s limited to functions within the actual call stack and just trimming from the top, rather than allowing arbitrary modifications.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 27 (6 by maintainers)
@matthewp My current understanding is yes.* (Not a TC39 member, though.)
* It’s settable in most browsers, but not all. Notably, old PhantomJS attached a non-configurable
stackwhen an error was thrown, which is both horribly inconvenient and seriously complicating for error printing.@isiahmeadows that specific use case would probably be addressed by the last checkbox in #1.